# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
668179 | 2022-12-03T08:10:59 Z | MrDeboo | Zalmoxis (BOI18_zalmoxis) | C++17 | 108 ms | 34216 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(); while(k--){ dq.push_back(g++); } assert(k>=0); 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+1); } } // assert(deq.size()==1); for(auto &i:dq)cout<<i<<' '; }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Runtime error | 94 ms | 34080 KB | Execution killed with signal 6 |
2 | Runtime error | 96 ms | 34128 KB | Execution killed with signal 6 |
3 | Runtime error | 99 ms | 34216 KB | Execution killed with signal 6 |
4 | Runtime error | 99 ms | 34120 KB | Execution killed with signal 6 |
5 | Runtime error | 91 ms | 34180 KB | Execution killed with signal 6 |
6 | Runtime error | 108 ms | 34108 KB | Execution killed with signal 6 |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Runtime error | 91 ms | 34092 KB | Execution killed with signal 6 |
2 | Runtime error | 96 ms | 34032 KB | Execution killed with signal 6 |
3 | Runtime error | 95 ms | 34196 KB | Execution killed with signal 6 |
4 | Runtime error | 93 ms | 34108 KB | Execution killed with signal 6 |
5 | Runtime error | 95 ms | 34196 KB | Execution killed with signal 6 |
6 | Runtime error | 95 ms | 34080 KB | Execution killed with signal 6 |
7 | Runtime error | 91 ms | 34112 KB | Execution killed with signal 6 |
8 | Runtime error | 91 ms | 34076 KB | Execution killed with signal 6 |
9 | Runtime error | 79 ms | 30560 KB | Execution killed with signal 6 |
10 | Runtime error | 41 ms | 22120 KB | Execution killed with signal 6 |
11 | Runtime error | 61 ms | 25560 KB | Execution killed with signal 6 |
12 | Runtime error | 16 ms | 17100 KB | Execution killed with signal 6 |
13 | Runtime error | 15 ms | 17124 KB | Execution killed with signal 6 |
14 | Runtime error | 15 ms | 17124 KB | Execution killed with signal 6 |