# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
668186 | 2022-12-03T08:23:43 Z | MrDeboo | Zalmoxis (BOI18_zalmoxis) | C++17 | 148 ms | 20384 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); } } int g=a.back(); if(g==30) for(auto &i:dq)cout<<i<<' '; else{ for(int i=g;i<=29&&k;i++){ dq.push_back(i); k--; } int z=dq.back(); dq.pop_back(); k++; deque<int>dqq={z}; while(dqq.size()*2<=k){ int x=dqq.size(); for(int i=0;i<x;i++){ dqq.push_back(dqq[i]-1); dqq.push_back(dqq[i]-1); } for(int i=0;i<x;i++){ dqq.pop_front(); } } int c=dqq.size()*2-k; for(int i=0;i<c;i++){ dq.push_back(dqq[i]); } for(int i=c;i<dqq.size();i++){ dq.push_back(dqq[i]-1); dq.push_back(dqq[i]-1); } } }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 136 ms | 20196 KB | Output is correct |
2 | Correct | 138 ms | 20160 KB | Output is correct |
3 | Correct | 134 ms | 20152 KB | Output is correct |
4 | Correct | 138 ms | 20140 KB | Output is correct |
5 | Correct | 134 ms | 20248 KB | Output is correct |
6 | Correct | 132 ms | 20156 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 141 ms | 20156 KB | Unexpected end of file - int32 expected |
2 | Correct | 140 ms | 20160 KB | Output is correct |
3 | Incorrect | 135 ms | 20384 KB | Unexpected end of file - int32 expected |
4 | Incorrect | 138 ms | 20244 KB | Unexpected end of file - int32 expected |
5 | Incorrect | 142 ms | 20288 KB | Unexpected end of file - int32 expected |
6 | Incorrect | 142 ms | 20184 KB | Unexpected end of file - int32 expected |
7 | Incorrect | 143 ms | 20208 KB | Unexpected end of file - int32 expected |
8 | Incorrect | 148 ms | 20204 KB | Unexpected end of file - int32 expected |
9 | Incorrect | 119 ms | 17408 KB | Unexpected end of file - int32 expected |
10 | Incorrect | 40 ms | 15332 KB | Unexpected end of file - int32 expected |
11 | Incorrect | 87 ms | 11444 KB | Unexpected end of file - int32 expected |
12 | Incorrect | 18 ms | 12776 KB | Unexpected end of file - int32 expected |
13 | Incorrect | 16 ms | 12764 KB | Unexpected end of file - int32 expected |
14 | Incorrect | 17 ms | 12768 KB | Unexpected end of file - int32 expected |