# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
304005 | 2020-09-20T23:56:02 Z | fadi57 | Carnival (CEOI14_carnival) | C++14 | 2 ms | 256 KB |
#include <bits/stdc++.h> using namespace std; typedef long long ll; const int mx=160; int cnt=0; int par[mx]; int n; int costume[mx]; int query(int x,int y){ for(int i=0;i<x;i++){ cout<<par[i]+1<<" "; }int an; cout<<y; cout<<endl;cin>>an; return an; } int main() { cin>>n; if(n==1){ cout<<0<<" 1"; }else if(n==2){ cout<<2<<" 1 2"<<endl; int x;cin>>x; if(x==1){ cout<<"0 1 1"; }else{ cout<<"0 1 2"; }cout<<endl; }else{ cnt=1; for(int i=1;i<n;i++){ if(query(cnt,i)==(cnt+1)){ costume[i]=cnt; par[cnt]=i; cnt++; }else{ int s=0;int end=cnt-1;ll where; while(s<end){ int mid=(s+end)/2; if(query(mid,i)==(mid)+1){ end=mid-1;where =mid; }else{ s=mid+1; } } costume[i]=where; } } } cout<<0<<" "; for(int i=0;i<n;i++){ cout<<costume[i]+1<<" "; }cout<<endl; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 2 ms | 256 KB | Integer 4859297 violates the range [1, 11] |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 2 ms | 256 KB | Integer 4859297 violates the range [1, 5] |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 2 ms | 256 KB | Integer 4859297 violates the range [1, 1] |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 2 ms | 256 KB | Integer 4859297 violates the range [1, 4] |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 1 ms | 256 KB | Integer 4859297 violates the range [1, 2] |
2 | Halted | 0 ms | 0 KB | - |