#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define all(x) x.begin(),x.end()
#define ff first
#define ss second
int cnt[40];
int val=-1;
void dfs(int v){
bool flag=false;
for(int i=0;i<v;i++){
if(cnt[i]!=0){
flag=true;
}
}
if(!flag){
val=v;
return;
}
if(cnt[v-1]==1){
cnt[v-1]--;
dfs(v-1);
}
else if(cnt[v-1]==0){
dfs(v-1);
dfs(v-1);
}
else if(cnt[v-1]==2){
cnt[v-1]=0;
}
}
signed main(){
int n,k;
cin>>n>>k;
vector <int> a(n);
for(int i=0;i<n;i++){
cin>>a[i];
cnt[a[i]]++;
}
dfs(30);
for(int i=0;i<n;i++){
cout<<a[i]<<" ";
}
cout<<val<<" ";
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
168 ms |
8444 KB |
not a zalsequence |
2 |
Incorrect |
162 ms |
8284 KB |
not a zalsequence |
3 |
Incorrect |
169 ms |
8284 KB |
not a zalsequence |
4 |
Incorrect |
163 ms |
8272 KB |
not a zalsequence |
5 |
Incorrect |
168 ms |
8528 KB |
not a zalsequence |
6 |
Incorrect |
163 ms |
8428 KB |
not a zalsequence |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
173 ms |
8276 KB |
Unexpected end of file - int32 expected |
2 |
Incorrect |
164 ms |
8296 KB |
Unexpected end of file - int32 expected |
3 |
Incorrect |
165 ms |
8532 KB |
Unexpected end of file - int32 expected |
4 |
Incorrect |
161 ms |
8272 KB |
Unexpected end of file - int32 expected |
5 |
Incorrect |
175 ms |
8388 KB |
Unexpected end of file - int32 expected |
6 |
Incorrect |
160 ms |
8412 KB |
Unexpected end of file - int32 expected |
7 |
Incorrect |
162 ms |
8308 KB |
Unexpected end of file - int32 expected |
8 |
Incorrect |
162 ms |
8528 KB |
Unexpected end of file - int32 expected |
9 |
Incorrect |
128 ms |
6992 KB |
Unexpected end of file - int32 expected |
10 |
Incorrect |
49 ms |
2644 KB |
Unexpected end of file - int32 expected |
11 |
Incorrect |
82 ms |
4436 KB |
Unexpected end of file - int32 expected |
12 |
Incorrect |
0 ms |
348 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 |