Submission #64048

# Submission time Handle Problem Language Result Execution time Memory
64048 2018-08-03T08:52:08 Z Just_Solve_The_Problem parentrises (BOI18_parentrises) C++11
0 / 100
3 ms 484 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];
map < int, int > cnt;

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

parentrises.cpp:12:6: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
 main() {
      ^
parentrises.cpp: In function 'int main()':
parentrises.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);
   ~~~~~^~~~~~~~~~~~~~~~~
parentrises.cpp:16:10: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
     scanf("%d", &a[i]);
     ~~~~~^~~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Incorrect 3 ms 244 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 3 ms 484 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 3 ms 484 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 3 ms 484 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 3 ms 484 KB Output isn't correct
# Verdict Execution time Memory Grader output
1 Incorrect 3 ms 484 KB Output isn't correct
# Verdict Execution time Memory Grader output
1 Incorrect 3 ms 484 KB Output isn't correct