답안 #861931

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
861931 2023-10-17T07:48:56 Z Aiperiii Zalmoxis (BOI18_zalmoxis) C++14
0 / 100
1000 ms 6712 KB
#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;
    }
    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<<" ";
}
 
# 결과 실행 시간 메모리 Grader output
1 Incorrect 166 ms 6384 KB not a zalsequence
2 Incorrect 157 ms 6384 KB not a zalsequence
3 Incorrect 173 ms 6712 KB not a zalsequence
4 Incorrect 158 ms 6400 KB not a zalsequence
5 Incorrect 156 ms 6396 KB not a zalsequence
6 Incorrect 159 ms 6384 KB not a zalsequence
# 결과 실행 시간 메모리 Grader output
1 Incorrect 160 ms 6712 KB Unexpected end of file - int32 expected
2 Incorrect 166 ms 6224 KB Unexpected end of file - int32 expected
3 Incorrect 159 ms 6388 KB Unexpected end of file - int32 expected
4 Incorrect 157 ms 6384 KB Unexpected end of file - int32 expected
5 Incorrect 158 ms 6396 KB Unexpected end of file - int32 expected
6 Incorrect 162 ms 6208 KB Unexpected end of file - int32 expected
7 Incorrect 158 ms 6192 KB Unexpected end of file - int32 expected
8 Incorrect 160 ms 6224 KB Unexpected end of file - int32 expected
9 Incorrect 127 ms 5064 KB Unexpected end of file - int32 expected
10 Incorrect 49 ms 2128 KB Unexpected end of file - int32 expected
11 Incorrect 79 ms 3184 KB Unexpected end of file - int32 expected
12 Execution timed out 1046 ms 348 KB Time limit exceeded
13 Execution timed out 1042 ms 348 KB Time limit exceeded
14 Execution timed out 1022 ms 348 KB Time limit exceeded