# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
680678 | 2023-01-11T13:53:20 Z | Duy_e | Zalmoxis (BOI18_zalmoxis) | C++14 | 31 ms | 47404 KB |
#include <bits/stdc++.h> #define ll long long #define st first #define nd second #define pii pair <ll, ll> #define rep(i, n, m) for (ll i = (n); i <= (m); i ++) #define rrep(i, n, m) for (ll i = (n); i >= (m); i --) using namespace std; const long long N = 2e6 + 10; ll n, k, a[N], b[N], cnt; vector <int> d[N]; void write(int v) { if (v == 0 || k == 0) { cout << v << ' '; return; } if (k > 0) { k --; write(v - 1); write(v - 1); } } int main() { ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); freopen("test.inp", "r", stdin); freopen("test.out", "w", stdout); cin >> n >> k; vector <pii> b; rep(i, 1, n) cin >> a[i], b.push_back({a[i], i}); int cnt = 0; rep(val, 25, 29) { vector <pii> v; for (int id = 0; id < b.size(); id ++) { int x = b[id].st; if (val != x) v.push_back(b[id]); else { if (id + 1 < b.size() && b[id + 1].st == val) v.push_back({val + 1, b[id + 1].nd}), id ++; else { d[b[id].nd].push_back(val); v.push_back({val + 1, b[id].nd}); k --; cnt ++; if (k == 0) break; } } if (k == 0) break; } if (k == 0) break; b = v; } k += cnt; rep(i, 1, n) { cout << a[i] << ' '; for (int v: d[i]) { k --; write(v); // cout << v << ' '; } } return 0; }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Incorrect | 24 ms | 47316 KB | Unexpected end of file - int32 expected |
2 | Incorrect | 29 ms | 47264 KB | Unexpected end of file - int32 expected |
3 | Incorrect | 23 ms | 47404 KB | Unexpected end of file - int32 expected |
4 | Incorrect | 23 ms | 47340 KB | Unexpected end of file - int32 expected |
5 | Incorrect | 24 ms | 47316 KB | Unexpected end of file - int32 expected |
6 | Incorrect | 24 ms | 47308 KB | Unexpected end of file - int32 expected |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Incorrect | 24 ms | 47316 KB | Unexpected end of file - int32 expected |
2 | Incorrect | 25 ms | 47284 KB | Unexpected end of file - int32 expected |
3 | Incorrect | 23 ms | 47316 KB | Unexpected end of file - int32 expected |
4 | Incorrect | 24 ms | 47352 KB | Unexpected end of file - int32 expected |
5 | Incorrect | 23 ms | 47316 KB | Unexpected end of file - int32 expected |
6 | Incorrect | 24 ms | 47228 KB | Unexpected end of file - int32 expected |
7 | Incorrect | 24 ms | 47316 KB | Unexpected end of file - int32 expected |
8 | Incorrect | 23 ms | 47336 KB | Unexpected end of file - int32 expected |
9 | Incorrect | 23 ms | 47328 KB | Unexpected end of file - int32 expected |
10 | Incorrect | 31 ms | 47256 KB | Unexpected end of file - int32 expected |
11 | Incorrect | 24 ms | 47240 KB | Unexpected end of file - int32 expected |
12 | Incorrect | 25 ms | 47296 KB | Unexpected end of file - int32 expected |
13 | Incorrect | 28 ms | 47260 KB | Unexpected end of file - int32 expected |
14 | Incorrect | 24 ms | 47340 KB | Unexpected end of file - int32 expected |