답안 #64044

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
64044 2018-08-03T08:47:24 Z Just_Solve_The_Problem Zalmoxis (BOI18_zalmoxis) C++11
0 / 100
259 ms 6804 KB
#include <bits/stdc++.h>

using namespace std;

const int N = (int)1e6 + 7;
const int inf = (int)1e9 + 7;

int n, k;
int a[N];
int cnt[N];

main() {
  scanf("%d %d", &n, &k);
  int mn = inf;
  for (int i = 1; i <= n; i++) {
    scanf("%d", &a[i]);
    mn = min(mn, a[i]);
    cnt[a[i]]++;
  }
  int 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 - 1) {
      if (cur != -1) {
        printf("%d ", cur);
        cur = -1;
      }
    }
    printf("%d ", a[i]);
  }
}

Compilation message

zalmoxis.cpp:12:6: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
 main() {
      ^
zalmoxis.cpp: In function 'int main()':
zalmoxis.cpp:13: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:16:10: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
     scanf("%d", &a[i]);
     ~~~~~^~~~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Incorrect 206 ms 6268 KB not a zalsequence
2 Incorrect 225 ms 6388 KB not a zalsequence
3 Incorrect 208 ms 6440 KB not a zalsequence
4 Incorrect 209 ms 6440 KB not a zalsequence
5 Incorrect 208 ms 6500 KB not a zalsequence
6 Incorrect 242 ms 6500 KB not a zalsequence
# 결과 실행 시간 메모리 Grader output
1 Incorrect 203 ms 6520 KB Unexpected end of file - int32 expected
2 Incorrect 259 ms 6648 KB Unexpected end of file - int32 expected
3 Incorrect 185 ms 6804 KB Unexpected end of file - int32 expected
4 Incorrect 195 ms 6804 KB Unexpected end of file - int32 expected
5 Incorrect 224 ms 6804 KB Unexpected end of file - int32 expected
6 Incorrect 227 ms 6804 KB Unexpected end of file - int32 expected
7 Incorrect 237 ms 6804 KB Unexpected end of file - int32 expected
8 Incorrect 207 ms 6804 KB Unexpected end of file - int32 expected
9 Incorrect 178 ms 6804 KB Unexpected end of file - int32 expected
10 Incorrect 101 ms 6804 KB Unexpected end of file - int32 expected
11 Incorrect 138 ms 6804 KB Unexpected end of file - int32 expected
12 Incorrect 4 ms 6804 KB Unexpected end of file - int32 expected
13 Incorrect 2 ms 6804 KB Unexpected end of file - int32 expected
14 Incorrect 2 ms 6804 KB Unexpected end of file - int32 expected