#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);
cout<<val<<" ";
for(int i=0;i<n;i++){
cout<<a[i]<<" ";
}
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
160 ms |
8272 KB |
not a zalsequence |
2 |
Incorrect |
162 ms |
8276 KB |
not a zalsequence |
3 |
Incorrect |
161 ms |
8436 KB |
not a zalsequence |
4 |
Incorrect |
169 ms |
8408 KB |
not a zalsequence |
5 |
Incorrect |
159 ms |
8456 KB |
not a zalsequence |
6 |
Incorrect |
166 ms |
8368 KB |
not a zalsequence |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
162 ms |
8276 KB |
Unexpected end of file - int32 expected |
2 |
Incorrect |
160 ms |
8276 KB |
Unexpected end of file - int32 expected |
3 |
Incorrect |
170 ms |
8276 KB |
Unexpected end of file - int32 expected |
4 |
Incorrect |
162 ms |
8436 KB |
Unexpected end of file - int32 expected |
5 |
Incorrect |
168 ms |
8292 KB |
Unexpected end of file - int32 expected |
6 |
Incorrect |
161 ms |
8412 KB |
Unexpected end of file - int32 expected |
7 |
Incorrect |
161 ms |
8276 KB |
Unexpected end of file - int32 expected |
8 |
Incorrect |
161 ms |
8284 KB |
Unexpected end of file - int32 expected |
9 |
Incorrect |
136 ms |
6872 KB |
Unexpected end of file - int32 expected |
10 |
Incorrect |
48 ms |
2644 KB |
Unexpected end of file - int32 expected |
11 |
Incorrect |
80 ms |
4436 KB |
Unexpected end of file - int32 expected |
12 |
Incorrect |
1 ms |
344 KB |
Unexpected end of file - int32 expected |
13 |
Incorrect |
0 ms |
344 KB |
Unexpected end of file - int32 expected |
14 |
Incorrect |
0 ms |
348 KB |
Unexpected end of file - int32 expected |