# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
738436 | 2023-05-08T18:47:18 Z | LucaGreg | Carnival (CEOI14_carnival) | C++14 | 24 ms | 208 KB |
#include <bits/stdc++.h> using namespace std; #define pb push_back #define ff first #define ss second #define int long long int const int INF = 2000000000000000; const int mod = 1000000007; int marc[210]; int n; int bb(int id, int ini, int fim){ vector<int> query; for(int i=ini;i<=fim;i++) if(marc[i]==0) query.pb(i); if(query.empty()) return -1; cout<<query.size()<<" "; for(int i=0;i<(int)query.size();i++) cout<<query[i]<<" "; cout<<"\n"; cout.flush(); int qtd; cin>>qtd; query.pb(id); cout<<query.size()<<" "; for(int i=0;i<(int)query.size();i++) cout<<query[i]<<" "; cout<<"\n"; cout.flush(); int qtdId; cin>>qtdId; if(qtdId>qtd) return -1; while(ini<fim){ query.clear(); int m = (ini + fim)/2; for(int i=ini;i<=m;i++) if(marc[i]==0) query.pb(i); if(query.empty()){ ini = m + 1; continue; } int auxQtd; if((int)query.size()>1){ cout<<query.size()<<" "; for(int i=0;i<(int)query.size();i++) cout<<query[i]<<" "; cout<<"\n"; cout.flush(); cin>>auxQtd; }else{ auxQtd = 1; } query.pb(id); cout<<query.size()<<" "; for(int i=0;i<(int)query.size();i++) cout<<query[i]<<" "; cout<<"\n"; cout.flush(); int auxQtdId; cin>>auxQtdId; if(auxQtdId>auxQtd) ini = m + 1; else fim = m; } return fim; } main() { ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(0); cin>>n; int curType = 1; for(int i=1;i<=n;i++){ if(marc[i]!=0) continue; marc[i] = curType; while(true){ int id = bb(i, i + 1, n); if(id==-1) break; marc[id] = curType; } curType++; } cout<<0<<" "; for(int i=1;i<=n;i++) cout<<marc[i]<<" "; cout<<"\n"; return 0; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 16 ms | 208 KB | Output is correct |
2 | Correct | 12 ms | 208 KB | Output is correct |
3 | Correct | 8 ms | 208 KB | Output is correct |
4 | Correct | 4 ms | 208 KB | Output is correct |
5 | Correct | 16 ms | 208 KB | Output is correct |
6 | Correct | 13 ms | 208 KB | Output is correct |
7 | Correct | 20 ms | 208 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 21 ms | 208 KB | Output is correct |
2 | Correct | 14 ms | 208 KB | Output is correct |
3 | Correct | 5 ms | 208 KB | Output is correct |
4 | Correct | 6 ms | 208 KB | Output is correct |
5 | Correct | 19 ms | 208 KB | Output is correct |
6 | Correct | 15 ms | 208 KB | Output is correct |
7 | Correct | 18 ms | 208 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 10 ms | 208 KB | Output is correct |
2 | Correct | 18 ms | 208 KB | Output is correct |
3 | Correct | 14 ms | 208 KB | Output is correct |
4 | Correct | 8 ms | 208 KB | Output is correct |
5 | Correct | 20 ms | 208 KB | Output is correct |
6 | Correct | 19 ms | 208 KB | Output is correct |
7 | Correct | 19 ms | 208 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 22 ms | 208 KB | Output is correct |
2 | Correct | 12 ms | 208 KB | Output is correct |
3 | Correct | 7 ms | 208 KB | Output is correct |
4 | Correct | 6 ms | 208 KB | Output is correct |
5 | Correct | 18 ms | 208 KB | Output is correct |
6 | Correct | 14 ms | 208 KB | Output is correct |
7 | Correct | 19 ms | 208 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 16 ms | 208 KB | Output is correct |
2 | Correct | 24 ms | 208 KB | Output is correct |
3 | Correct | 10 ms | 208 KB | Output is correct |
4 | Correct | 14 ms | 208 KB | Output is correct |
5 | Correct | 15 ms | 208 KB | Output is correct |
6 | Correct | 10 ms | 208 KB | Output is correct |
7 | Correct | 6 ms | 208 KB | Output is correct |