# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
600522 | 2022-07-21T02:08:45 Z | AryamanRtunjay | Carnival (CEOI14_carnival) | C++17 | 18 ms | 328 KB |
#include <iostream> #include <vector> #define pb push_back #define MAXN 155 using namespace std; int n, prosli[MAXN], ress[MAXN]; vector<int> novi; bool check(int k, int i) { cout<<k+1<<" "; for (int j=0; j<=k; j++) cout<<novi[j]<<" "; cout<<endl; int cnt1; cin>>cnt1; cout<<k+2<<" "; for (int j=0; j<=k; j++) cout<<novi[j]<<" "; cout<<i<<endl; int cnt2; cin>>cnt2; return (cnt1==cnt2); } int main() { cin>>n; int cnt=1; novi.pb(1); for (int i=2; i<=n; i++) { vector<int> sta; for (int j=1; j<=i; j++) sta.pb(j); cout<<sta.size()<<" "; for (int i=0; i<sta.size(); i++) cout<<sta[i]<<" "; cout<<endl; int tren; cin>>tren; if (tren>cnt) { prosli[i]=0; cnt=tren; novi.pb(i); } else { int l=0, r=novi.size()-1, gde=-1; while (l<=r) { int mid=l+(r-l)/2; if (check(mid, i)) { r=mid-1; gde=mid; } else l=mid+1; } prosli[i]=novi[gde]; } } int col=1; for (int i=1; i<=n; i++) { if (prosli[i]==0) { ress[i]=col++; } else ress[i]=ress[prosli[i]]; } cout<<0<<" "; for (int i=1; i<=n; i++) cout<<ress[i]<<" "; cout<<endl; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 10 ms | 208 KB | Output is correct |
2 | Correct | 11 ms | 208 KB | Output is correct |
3 | Correct | 7 ms | 304 KB | Output is correct |
4 | Correct | 4 ms | 208 KB | Output is correct |
5 | Correct | 7 ms | 208 KB | Output is correct |
6 | Correct | 4 ms | 300 KB | Output is correct |
7 | Correct | 12 ms | 208 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 8 ms | 208 KB | Output is correct |
2 | Correct | 18 ms | 300 KB | Output is correct |
3 | Correct | 4 ms | 304 KB | Output is correct |
4 | Correct | 7 ms | 304 KB | Output is correct |
5 | Correct | 8 ms | 208 KB | Output is correct |
6 | Correct | 9 ms | 284 KB | Output is correct |
7 | Correct | 9 ms | 208 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 4 ms | 208 KB | Output is correct |
2 | Correct | 11 ms | 208 KB | Output is correct |
3 | Correct | 15 ms | 208 KB | Output is correct |
4 | Correct | 4 ms | 208 KB | Output is correct |
5 | Correct | 8 ms | 304 KB | Output is correct |
6 | Correct | 10 ms | 208 KB | Output is correct |
7 | Correct | 14 ms | 328 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 9 ms | 284 KB | Output is correct |
2 | Correct | 12 ms | 208 KB | Output is correct |
3 | Correct | 7 ms | 208 KB | Output is correct |
4 | Correct | 3 ms | 208 KB | Output is correct |
5 | Correct | 9 ms | 308 KB | Output is correct |
6 | Correct | 9 ms | 304 KB | Output is correct |
7 | Correct | 12 ms | 300 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 6 ms | 304 KB | Output is correct |
2 | Correct | 16 ms | 300 KB | Output is correct |
3 | Correct | 9 ms | 208 KB | Output is correct |
4 | Correct | 10 ms | 208 KB | Output is correct |
5 | Correct | 8 ms | 300 KB | Output is correct |
6 | Correct | 5 ms | 208 KB | Output is correct |
7 | Correct | 4 ms | 300 KB | Output is correct |