Submission #64061

#TimeUsernameProblemLanguageResultExecution timeMemory
64061Just_Solve_The_ProblemZalmoxis (BOI18_zalmoxis)C++11
0 / 100
255 ms10432 KiB
#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]); } }

Compilation message (stderr)

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]);
     ~~~~~^~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...