'commit'
This commit is contained in:
27
GESP/Level5/Test2.cpp
Normal file
27
GESP/Level5/Test2.cpp
Normal file
@@ -0,0 +1,27 @@
|
||||
#include <bits/stdc++.h>
|
||||
using namespace std;
|
||||
const int N = 2e5 + 10;
|
||||
int b[N], c[N], d[N];
|
||||
int main() {
|
||||
int n;
|
||||
cin >> n;
|
||||
int sum = 0;
|
||||
for (int i = 1; i <= 2 * n; i++) {
|
||||
cin >> b[i];
|
||||
sum += b[i];
|
||||
}
|
||||
|
||||
for (int i = 1; i <= 2 * n; i++)
|
||||
cin >> c[i];
|
||||
|
||||
for (int i = 1; i <= 2 * n; i++)
|
||||
d[i] = c[i] - b[i];
|
||||
|
||||
sort(d + 1, d + 2 * n + 1);
|
||||
|
||||
for (int i = n + 1; i <= 2 * n; i++)
|
||||
sum += d[i];
|
||||
|
||||
cout << sum;
|
||||
cin >> n;
|
||||
}
|
||||
Reference in New Issue
Block a user