# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
64063 | Just_Solve_The_Problem | Zalmoxis (BOI18_zalmoxis) | C++17 | 433 ms | 10596 KiB |
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 <bits/stdc++.h>
using namespace std;
#define ll long long
const int N = (int)1e6 + 7;
const int inf = (int)1e9 + 7;
int n, k;
ll a[N];
map < ll, int > cnt;
main() {
scanf("%d %d", &n, &k);
ll mn = (ll)1e18;
for (int i = 1; i <= n; i++) {
cin >> a[i];
mn = min(mn, a[i]);
cnt[a[i]]++;
}
ll cur = -1;
while (1) {
if (cnt[mn] & 1) {
cur = mn;
break;
}
cnt[mn + 1] += cnt[mn] / 2;
cnt[mn] = 0;
mn++;
}
int in;
for (int i = 1; i <= n; i++) {
if (a[i] <= cur) {
in = i;
}
}
for (int i = 1; i <= n; i++) {
if (i == in)
cout << cur << ' ';
cout << a[i] << ' ';
}
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |