답안 #64063

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
64063 2018-08-03T09:40:17 Z Just_Solve_The_Problem Zalmoxis (BOI18_zalmoxis) C++17
10 / 100
433 ms 10596 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);
  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

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:39:5: warning: 'in' may be used uninitialized in this function [-Wmaybe-uninitialized]
     if (i == in)
     ^~
# 결과 실행 시간 메모리 Grader output
1 Incorrect 320 ms 10180 KB not a zalsequence
2 Incorrect 376 ms 10428 KB not a zalsequence
3 Incorrect 332 ms 10428 KB not a zalsequence
4 Correct 395 ms 10452 KB Output is correct
5 Correct 308 ms 10452 KB Output is correct
6 Incorrect 381 ms 10452 KB not a zalsequence
# 결과 실행 시간 메모리 Grader output
1 Incorrect 433 ms 10524 KB Unexpected end of file - int32 expected
2 Incorrect 330 ms 10524 KB Unexpected end of file - int32 expected
3 Incorrect 350 ms 10524 KB Unexpected end of file - int32 expected
4 Incorrect 331 ms 10596 KB Unexpected end of file - int32 expected
5 Incorrect 373 ms 10596 KB Unexpected end of file - int32 expected
6 Incorrect 334 ms 10596 KB Unexpected end of file - int32 expected
7 Incorrect 377 ms 10596 KB Unexpected end of file - int32 expected
8 Incorrect 351 ms 10596 KB Unexpected end of file - int32 expected
9 Incorrect 299 ms 10596 KB Unexpected end of file - int32 expected
10 Incorrect 109 ms 10596 KB Unexpected end of file - int32 expected
11 Incorrect 171 ms 10596 KB Unexpected end of file - int32 expected
12 Incorrect 3 ms 10596 KB Unexpected end of file - int32 expected
13 Incorrect 3 ms 10596 KB Unexpected end of file - int32 expected
14 Incorrect 3 ms 10596 KB Unexpected end of file - int32 expected