# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
738437 | 2023-05-08T18:48:13 Z | LucaGreg | Carnival (CEOI14_carnival) | C++17 | 27 ms | 280 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[160]; 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 | 19 ms | 208 KB | Output is correct |
2 | Correct | 17 ms | 208 KB | Output is correct |
3 | Correct | 8 ms | 208 KB | Output is correct |
4 | Correct | 5 ms | 208 KB | Output is correct |
5 | Correct | 15 ms | 208 KB | Output is correct |
6 | Correct | 15 ms | 208 KB | Output is correct |
7 | Correct | 15 ms | 208 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 19 ms | 208 KB | Output is correct |
2 | Correct | 15 ms | 208 KB | Output is correct |
3 | Correct | 6 ms | 208 KB | Output is correct |
4 | Correct | 6 ms | 208 KB | Output is correct |
5 | Correct | 17 ms | 208 KB | Output is correct |
6 | Correct | 18 ms | 280 KB | Output is correct |
7 | Correct | 15 ms | 208 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 14 ms | 208 KB | Output is correct |
2 | Correct | 11 ms | 208 KB | Output is correct |
3 | Correct | 8 ms | 208 KB | Output is correct |
4 | Correct | 5 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 | 15 ms | 208 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 19 ms | 208 KB | Output is correct |
2 | Correct | 18 ms | 208 KB | Output is correct |
3 | Correct | 9 ms | 208 KB | Output is correct |
4 | Correct | 5 ms | 208 KB | Output is correct |
5 | Correct | 27 ms | 208 KB | Output is correct |
6 | Correct | 13 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 | 20 ms | 208 KB | Output is correct |
3 | Correct | 9 ms | 208 KB | Output is correct |
4 | Correct | 9 ms | 208 KB | Output is correct |
5 | Correct | 14 ms | 208 KB | Output is correct |
6 | Correct | 11 ms | 208 KB | Output is correct |
7 | Correct | 8 ms | 208 KB | Output is correct |