# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
1108716 | 2024-11-04T20:32:41 Z | vicvic | Zalmoxis (BOI18_zalmoxis) | C++11 | 121 ms | 24520 KB |
#include <iostream> #include <fstream> #include <cassert> using namespace std; ifstream f ("zalmoxis.in"); ofstream g ("zalmoxis.out"); int n, k, v[1000005], poz, added[1000005], s[1000005], cnt; void descp (int j) { if (j<=1) { cout << j << " "; } else if (k>0) { k--; descp (j-1); descp (j-1); } else cout << j << " "; } void propag () { while (cnt>=2) { int a=s[cnt], b=s[cnt-1]; if (a==b) { cnt--; s[cnt]=a+1; } else { return; } } } int main() { cin >> n >> k; int poz=0, adaugate=0; for (int i=1; i<=n; i++) { int x; cin >> x; while (cnt && s[cnt]<x) { v[++poz]=s[cnt]; added[poz]=1; k--; s[++cnt]=s[cnt-1]; propag (); } v[++poz]=x; s[++cnt]=x; propag (); } while (s[1]<30) { k--; v[++poz]=s[cnt]; added[poz]=1; s[++cnt]=s[cnt-1]; propag (); } for (int i=1; i<=poz; i++) { if (added[poz]) { descp (v[i]); } else cout << v[i] << " "; } return 0; }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Runtime error | 102 ms | 11336 KB | Execution killed with signal 11 |
2 | Runtime error | 105 ms | 11336 KB | Execution killed with signal 11 |
3 | Runtime error | 102 ms | 11348 KB | Execution killed with signal 11 |
4 | Runtime error | 101 ms | 11336 KB | Execution killed with signal 11 |
5 | Runtime error | 103 ms | 11340 KB | Execution killed with signal 11 |
6 | Runtime error | 98 ms | 11336 KB | Execution killed with signal 11 |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Runtime error | 17 ms | 24144 KB | Execution killed with signal 11 |
2 | Runtime error | 17 ms | 24128 KB | Execution killed with signal 11 |
3 | Runtime error | 18 ms | 24144 KB | Execution killed with signal 11 |
4 | Runtime error | 18 ms | 24144 KB | Execution killed with signal 11 |
5 | Runtime error | 17 ms | 24144 KB | Execution killed with signal 11 |
6 | Runtime error | 20 ms | 24180 KB | Execution killed with signal 11 |
7 | Runtime error | 110 ms | 15688 KB | Execution killed with signal 11 |
8 | Runtime error | 121 ms | 19784 KB | Execution killed with signal 11 |
9 | Runtime error | 20 ms | 24368 KB | Execution killed with signal 11 |
10 | Runtime error | 20 ms | 24144 KB | Execution killed with signal 11 |
11 | Runtime error | 20 ms | 24144 KB | Execution killed with signal 11 |
12 | Runtime error | 20 ms | 24144 KB | Execution killed with signal 11 |
13 | Runtime error | 18 ms | 24144 KB | Execution killed with signal 11 |
14 | Runtime error | 19 ms | 24520 KB | Execution killed with signal 11 |