Submission #861904

# Submission time Handle Problem Language Result Execution time Memory
861904 2023-10-17T07:18:20 Z Aiperiii Zalmoxis (BOI18_zalmoxis) C++14
0 / 100
113 ms 6608 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;
vector <int> res;
void dfs(int v){
    bool flag=false;
    for(int i=0;i<v;i++){
        if(cnt[i]!=0){
            flag=true;
        }
    }
    if(!flag){
        val=v;
        res.push_back(v);
    }
    else{
        if(cnt[v-1]==1){
            res.push_back(v-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){
            res.push_back(v-1);
            res.push_back(v-1);
            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(auto i : res)cout<<i<<" ";
}

# Verdict Execution time Memory Grader output
1 Incorrect 105 ms 6224 KB Unexpected end of file - int32 expected
2 Incorrect 105 ms 6368 KB Unexpected end of file - int32 expected
3 Incorrect 106 ms 6224 KB Unexpected end of file - int32 expected
4 Incorrect 112 ms 6608 KB Unexpected end of file - int32 expected
5 Incorrect 110 ms 6228 KB Unexpected end of file - int32 expected
6 Incorrect 106 ms 6228 KB Unexpected end of file - int32 expected
# Verdict Execution time Memory Grader output
1 Incorrect 113 ms 6368 KB Unexpected end of file - int32 expected
2 Incorrect 106 ms 6364 KB Unexpected end of file - int32 expected
3 Incorrect 106 ms 6356 KB Unexpected end of file - int32 expected
4 Incorrect 108 ms 6368 KB Unexpected end of file - int32 expected
5 Incorrect 107 ms 6364 KB Unexpected end of file - int32 expected
6 Incorrect 107 ms 6236 KB Unexpected end of file - int32 expected
7 Incorrect 109 ms 6368 KB Unexpected end of file - int32 expected
8 Incorrect 106 ms 6252 KB Unexpected end of file - int32 expected
9 Incorrect 85 ms 5204 KB Unexpected end of file - int32 expected
10 Incorrect 32 ms 2136 KB Unexpected end of file - int32 expected
11 Incorrect 53 ms 3260 KB Unexpected end of file - int32 expected
12 Incorrect 1 ms 344 KB Unexpected end of file - int32 expected
13 Incorrect 1 ms 348 KB Unexpected end of file - int32 expected
14 Incorrect 1 ms 348 KB Unexpected end of file - int32 expected