Submission #647060

#TimeUsernameProblemLanguageResultExecution timeMemory
647060georgievskiyZalmoxis (BOI18_zalmoxis)C++17
30 / 100
319 ms27048 KiB
#include <bits/stdc++.h> using namespace std; #define pii pair<int, int> int main() { int n, k; cin >> n >> k; vector<int> a(n); for (int &x : a) cin >> x; vector<pii> t, q; for (int i = 0; i < n; i++) t.push_back({a[i], i}); for (int val = 0; val < 30; val++) { vector<pii> nt; for (int i = 0; i < t.size(); i++) { if (t[i].first != val) { nt.push_back(t[i]); continue; } if (i + 1 < t.size() && t[i].first == t[i + 1].first) { nt.push_back({t[i].first + 1, t[i + 1].second}); i++; } else { nt.push_back({t[i].first + 1, t[i].second}); q.push_back({t[i].second, t[i].first}); } } t = nt; } a.insert(a.begin() + q[0].first + 1, q[0].second); for (int x : a) cout << x << " "; return 0; }

Compilation message (stderr)

zalmoxis.cpp: In function 'int main()':
zalmoxis.cpp:15:21: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<std::pair<int, int> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   15 |   for (int i = 0; i < t.size(); i++) {
      |                   ~~^~~~~~~~~~
zalmoxis.cpp:20:14: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<std::pair<int, int> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   20 |    if (i + 1 < t.size() && t[i].first == t[i + 1].first) {
      |        ~~~~~~^~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...