# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
861928 | 2023-10-17T07:46:31 Z | Aiperiii | Zalmoxis (BOI18_zalmoxis) | C++14 | 1000 ms | 19744 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); return; } 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(){ freopen("zalmoxis.in","r",stdin); freopen("zalmoxis.out","w",stdout); 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<<" "; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Execution timed out | 1076 ms | 19548 KB | Time limit exceeded |
2 | Execution timed out | 1016 ms | 19544 KB | Time limit exceeded |
3 | Execution timed out | 1031 ms | 19544 KB | Time limit exceeded |
4 | Execution timed out | 1061 ms | 19548 KB | Time limit exceeded |
5 | Execution timed out | 1022 ms | 19544 KB | Time limit exceeded |
6 | Execution timed out | 1044 ms | 19548 KB | Time limit exceeded |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Execution timed out | 1063 ms | 19548 KB | Time limit exceeded |
2 | Execution timed out | 1035 ms | 19548 KB | Time limit exceeded |
3 | Execution timed out | 1073 ms | 19548 KB | Time limit exceeded |
4 | Execution timed out | 1073 ms | 19548 KB | Time limit exceeded |
5 | Execution timed out | 1016 ms | 19544 KB | Time limit exceeded |
6 | Execution timed out | 1043 ms | 19744 KB | Time limit exceeded |
7 | Execution timed out | 1058 ms | 19548 KB | Time limit exceeded |
8 | Execution timed out | 1060 ms | 19548 KB | Time limit exceeded |
9 | Execution timed out | 1067 ms | 19548 KB | Time limit exceeded |
10 | Execution timed out | 1022 ms | 19544 KB | Time limit exceeded |
11 | Execution timed out | 1059 ms | 19292 KB | Time limit exceeded |
12 | Execution timed out | 1048 ms | 19544 KB | Time limit exceeded |
13 | Execution timed out | 1073 ms | 19292 KB | Time limit exceeded |
14 | Execution timed out | 1055 ms | 19292 KB | Time limit exceeded |