답안 #64060

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
64060 2018-08-03T09:29:29 Z Just_Solve_The_Problem Zalmoxis (BOI18_zalmoxis) C++11
0 / 100
360 ms 10508 KB
#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++;
  }
  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]);
  }
}

Compilation message

zalmoxis.cpp:14:6: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
 main() {
      ^
zalmoxis.cpp: In function 'int main()':
zalmoxis.cpp:15:8: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   scanf("%d %d", &n, &k);
   ~~~~~^~~~~~~~~~~~~~~~~
zalmoxis.cpp:19:10: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
     scanf("%lld", &a[i]);
     ~~~~~^~~~~~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Incorrect 207 ms 10232 KB not a zalsequence
2 Incorrect 244 ms 10364 KB not a zalsequence
3 Incorrect 195 ms 10364 KB not a zalsequence
4 Incorrect 225 ms 10380 KB not a zalsequence
5 Incorrect 360 ms 10396 KB not a zalsequence
6 Incorrect 223 ms 10508 KB not a zalsequence
# 결과 실행 시간 메모리 Grader output
1 Runtime error 4 ms 10508 KB Execution killed with signal 11 (could be triggered by violating memory limits)
2 Runtime error 3 ms 10508 KB Execution killed with signal 11 (could be triggered by violating memory limits)
3 Runtime error 3 ms 10508 KB Execution killed with signal 11 (could be triggered by violating memory limits)
4 Runtime error 4 ms 10508 KB Execution killed with signal 11 (could be triggered by violating memory limits)
5 Runtime error 4 ms 10508 KB Execution killed with signal 11 (could be triggered by violating memory limits)
6 Runtime error 5 ms 10508 KB Execution killed with signal 11 (could be triggered by violating memory limits)
7 Runtime error 3 ms 10508 KB Execution killed with signal 11 (could be triggered by violating memory limits)
8 Runtime error 3 ms 10508 KB Execution killed with signal 11 (could be triggered by violating memory limits)
9 Runtime error 3 ms 10508 KB Execution killed with signal 11 (could be triggered by violating memory limits)
10 Runtime error 3 ms 10508 KB Execution killed with signal 11 (could be triggered by violating memory limits)
11 Runtime error 4 ms 10508 KB Execution killed with signal 11 (could be triggered by violating memory limits)
12 Runtime error 3 ms 10508 KB Execution killed with signal 11 (could be triggered by violating memory limits)
13 Runtime error 3 ms 10508 KB Execution killed with signal 11 (could be triggered by violating memory limits)
14 Runtime error 4 ms 10508 KB Execution killed with signal 11 (could be triggered by violating memory limits)