# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
862073 | 2023-10-17T13:30:47 Z | iskhakkutbilim | Zalmoxis (BOI18_zalmoxis) | C++17 | 118 ms | 5444 KB |
#include <bits/stdc++.h> using namespace std; #define ff first #define ss second #define all(a) a.begin(), a.end() int n, k; vector<int> ans; int st[35]; vector<int> First[35]; int del, idx; void f(int x, int depth){ if(x <= 0) return; int mn = 1; while(st[mn] <= 0 && 31 >= mn) mn++; if(mn > x){ ans.push_back(x); st[x]--; del++; }else if(First[x].empty() or First[x].back() + del > ans.size() + 1){ f(x-1, depth + 1); f(x-1, depth + 1); }else if(First[x].back() + del <= ans.size() + 1){ ans.push_back(x); First[x].pop_back(); st[x]--; }else assert(false); } main(){ cin >> n >> k; for(int i = 0;i < n; i++){ int x; cin >> x; st[x]++; First[x].push_back(i + 1); } for(int i = 1;i <= 30; i++){ reverse(all(First[i])); } /* 5 1 28 25 25 26 27 6 1 28 25 25 26 27 29 5 1 28 25 26 27 29 */ // f(30, 1); // while(ans.size() < n + k){ // vector<int> have = ans; // vector<int> merge; // ans.clear(); // for(int i = 0;i < have.size(); i++){ // if(have[i] > 1){ // f(have[i]-1, 1); // f(have[i]-1, 1); // for(int j = 0;j < i; j++) merge.push_back(have[j]); // for(int x : ans) merge.push_back(x); // for(int j = i + 1; j < have.size(); j++){ // merge.push_back(have[j]); // } // break; // } // } // if(merge.empty()) assert(false); // ans = merge; // } for(int i = 0;i < ans.size(); i++) cout << ans[i] << ' '; return 0; }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Incorrect | 110 ms | 4896 KB | Unexpected end of file - int32 expected |
2 | Incorrect | 113 ms | 5444 KB | Unexpected end of file - int32 expected |
3 | Incorrect | 111 ms | 5016 KB | Unexpected end of file - int32 expected |
4 | Incorrect | 110 ms | 5024 KB | Unexpected end of file - int32 expected |
5 | Incorrect | 117 ms | 4792 KB | Unexpected end of file - int32 expected |
6 | Incorrect | 109 ms | 4908 KB | Unexpected end of file - int32 expected |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Incorrect | 110 ms | 5120 KB | Unexpected end of file - int32 expected |
2 | Incorrect | 110 ms | 5160 KB | Unexpected end of file - int32 expected |
3 | Incorrect | 109 ms | 5264 KB | Unexpected end of file - int32 expected |
4 | Incorrect | 109 ms | 5392 KB | Unexpected end of file - int32 expected |
5 | Incorrect | 110 ms | 5028 KB | Unexpected end of file - int32 expected |
6 | Incorrect | 109 ms | 5364 KB | Unexpected end of file - int32 expected |
7 | Incorrect | 118 ms | 5172 KB | Unexpected end of file - int32 expected |
8 | Incorrect | 110 ms | 4640 KB | Unexpected end of file - int32 expected |
9 | Incorrect | 91 ms | 4128 KB | Unexpected end of file - int32 expected |
10 | Incorrect | 38 ms | 2188 KB | Unexpected end of file - int32 expected |
11 | Incorrect | 56 ms | 2752 KB | Unexpected end of file - int32 expected |
12 | Incorrect | 0 ms | 344 KB | Unexpected end of file - int32 expected |
13 | Incorrect | 0 ms | 348 KB | Unexpected end of file - int32 expected |
14 | Incorrect | 0 ms | 348 KB | Unexpected end of file - int32 expected |