This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <iostream>
#include <vector>
#include <cmath>
#include <set>
using namespace std;
#define pii pair<int, int>
vector<vector<int>>vec;
vector<bool>visit;
int main() {
int n, k;
cin >> n >> k;
vector<int>vec(n+k);
set<int>set1;
for (int i = 0; i < n + k; i++) {
cin >> vec[i];
set1.insert(vec[i]);
}
long long sum1 = 0;
for (int i = 1; i <= n + k; i++) {
sum1 += vec[i - 1];
}
for (int i = 0; i < n + k; i++) {
long long sum = sum1 - vec[i];
set1.erase(set1.find(vec[i]));
auto it = set1.begin();
auto it1 = set1.end();
--it1;
long long sum2 = (n / 2) * (*it1 + *it);
if (sum2 == sum) {
for (auto it2=set1.begin(); it2 != set1.end(); ++it2) {
cout << *it2 << " ";
}
break;
}
else {
set1.insert(vec[i]);
}
}
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |