# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
64061 | Just_Solve_The_Problem | Zalmoxis (BOI18_zalmoxis) | C++11 | 255 ms | 10432 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#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);
assert(k == 1);
ll mn = (ll)1e18;
for (int i = 1; i <= n; i++) {
scanf("%lld", &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++;
}
assert(cur != -1);
for (int i = 1; i <= n; i++) {
if (a[i] <= cur) {
if (cur != -1) {
printf("%lld ", cur);
cur = -1;
}
}
if (i == n) printf("%lld", a[i]);
else printf("%lld ", a[i]);
}
}
컴파일 시 표준 에러 (stderr) 메시지
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |