# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
668177 | 2022-12-03T08:09:05 Z | MrDeboo | Zalmoxis (BOI18_zalmoxis) | C++17 | 116 ms | 42668 KB |
#include <bits/stdc++.h> #include <ext/pb_ds/assoc_container.hpp> #include <ext/pb_ds/tree_policy.hpp> #define int long long #define endl '\n' using namespace std; using namespace __gnu_pbds; using ordered_set = tree<int,null_type,less_equal<int>,rb_tree_tag,tree_order_statistics_node_update>; signed main(){ ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0); int n,k; cin>>n>>k; deque<int>a,b(n); for(auto &i:b)cin>>i; deque<int>doq=b; deque<int>dq={b[0]}; a.push_back(b[0]); b.pop_front(); while(b.size()){ if(b[0]<=a.back()){ a.push_back(b[0]); dq.push_back(b[0]); b.pop_front(); }else{ k--; a.push_back(a.back()); dq.push_back(a.back()); } while(a.size()>1&&a.back()==a[a.size()-2]){ int A=a.back(); a.pop_back(); a.pop_back(); a.push_back(A+1); } } while(a.size()>1){ a.push_back(a.back()); dq.push_back(a.back()); k--; while(a.size()>1&&a.back()==a[a.size()-2]){ int A=a.back(); a.pop_back(); a.pop_back(); a.push_back(A+1); } } assert(k>=0); int g=a.back(); while(k--){ dq.push_back(g++); } int f=0; for(int i=0;i<dq.size();i++){ if(f<doq.size()&&doq[f]==dq[i])f++; } deque<int>deq; for(int i=0;i<dq.size();i++){ deq.push_back(dq[i]); while(deq.size()>1&&deq.back()==deq[deq.size()-2]){ int a=deq.back(); deq.pop_back(); deq.pop_back(); deq.push_back(a); } } assert(deq.size()==1); for(auto &i:dq)cout<<i<<' '; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Runtime error | 107 ms | 42464 KB | Execution killed with signal 6 |
2 | Runtime error | 111 ms | 42588 KB | Execution killed with signal 6 |
3 | Runtime error | 111 ms | 42524 KB | Execution killed with signal 6 |
4 | Runtime error | 110 ms | 42588 KB | Execution killed with signal 6 |
5 | Runtime error | 116 ms | 42532 KB | Execution killed with signal 6 |
6 | Runtime error | 109 ms | 42284 KB | Execution killed with signal 6 |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Runtime error | 113 ms | 42532 KB | Execution killed with signal 6 |
2 | Runtime error | 115 ms | 42284 KB | Execution killed with signal 6 |
3 | Runtime error | 110 ms | 42628 KB | Execution killed with signal 6 |
4 | Runtime error | 116 ms | 42668 KB | Execution killed with signal 6 |
5 | Runtime error | 112 ms | 42496 KB | Execution killed with signal 6 |
6 | Runtime error | 112 ms | 42420 KB | Execution killed with signal 6 |
7 | Runtime error | 113 ms | 42540 KB | Execution killed with signal 6 |
8 | Runtime error | 112 ms | 42656 KB | Execution killed with signal 6 |
9 | Runtime error | 98 ms | 40096 KB | Execution killed with signal 6 |
10 | Runtime error | 57 ms | 36208 KB | Execution killed with signal 6 |
11 | Runtime error | 75 ms | 37704 KB | Execution killed with signal 6 |
12 | Runtime error | 32 ms | 33692 KB | Execution killed with signal 6 |
13 | Runtime error | 31 ms | 33752 KB | Execution killed with signal 6 |
14 | Runtime error | 32 ms | 33756 KB | Execution killed with signal 6 |