# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
602321 | 2022-07-22T21:52:55 Z | UncoolAnon | Zalmoxis (BOI18_zalmoxis) | C++14 | 134 ms | 8392 KB |
#include <bits/stdc++.h> #define pii pair<int,int> #define F first #define S second #define mp make_pair using namespace std; signed main(){ ios_base::sync_with_stdio(0); cin.tie(nullptr); int n,k; cin>>n>>k; vector<int> a(n); for(int&x:a) cin>>x; int answer=(1<<30); for(int&x:a) answer-=(1<<x); vector<int> added,ones; for(int i=0;i<30;i++) if((1<<i)&answer){ added.push_back(i); } while(added.size()+ones.size()<k){ if(added.back()==0){ added.pop_back(); ones.push_back(0); } else{ int tmp=added.back(); added.pop_back(); added.push_back(tmp-1); added.push_back(tmp-1); } } for(int&x:a) cout << x << " "; for(int&x:added) cout << x << " " ; for(int&x:ones) cout << x << " " ; return 0 ; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 106 ms | 8372 KB | Output is correct |
2 | Correct | 104 ms | 8324 KB | Output is correct |
3 | Correct | 128 ms | 8316 KB | Output is correct |
4 | Correct | 104 ms | 8336 KB | Output is correct |
5 | Correct | 134 ms | 8392 KB | Output is correct |
6 | Correct | 103 ms | 8324 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 130 ms | 8344 KB | not a zalsequence |
2 | Incorrect | 108 ms | 8284 KB | not a zalsequence |
3 | Incorrect | 124 ms | 8372 KB | not a zalsequence |
4 | Incorrect | 105 ms | 8332 KB | not a zalsequence |
5 | Incorrect | 108 ms | 8392 KB | not a zalsequence |
6 | Incorrect | 108 ms | 8324 KB | not a zalsequence |
7 | Incorrect | 106 ms | 8384 KB | not a zalsequence |
8 | Incorrect | 110 ms | 8388 KB | not a zalsequence |
9 | Incorrect | 100 ms | 8044 KB | not a zalsequence |
10 | Incorrect | 85 ms | 7004 KB | not a zalsequence |
11 | Incorrect | 85 ms | 7412 KB | not a zalsequence |
12 | Incorrect | 68 ms | 6300 KB | not a zalsequence |
13 | Incorrect | 68 ms | 6300 KB | not a zalsequence |
14 | Correct | 66 ms | 6304 KB | Output is correct |