Submission #510298

#TimeUsernameProblemLanguageResultExecution timeMemory
510298SirCovidThe19thZalmoxis (BOI18_zalmoxis)C++17
100 / 100
292 ms43112 KiB
#include <bits/stdc++.h> using namespace std; int main(){ ios_base::sync_with_stdio(0); cin.tie(0); int n, k; cin >> n >> k; list<int> vals(1, 30); queue<list<int>::iterator> split; auto it = vals.begin(); for (int i = 0; i < n; i++){ int x; cin >> x; while (*it < x) split.push(it++); while (*it > x) (*it)--, it = vals.insert(it, *it); it++; } while (it != vals.end()) split.push(it++); while (vals.size() < n + k){ auto pos = split.front(); split.pop(); (*pos)--; vals.insert(pos, *pos); split.push(pos); split.push(--pos); } for (int i : vals) cout<<i<<" "; }

Compilation message (stderr)

zalmoxis.cpp: In function 'int main()':
zalmoxis.cpp:19:24: warning: comparison of integer expressions of different signedness: 'std::__cxx11::list<int>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   19 |     while (vals.size() < n + k){
      |            ~~~~~~~~~~~~^~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...