# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
172368 | 2020-01-01T12:02:16 Z | bharat2002 | Carnival (CEOI14_carnival) | C++14 | 29 ms | 504 KB |
/*input */ #include<bits/stdc++.h> using namespace std; const int N=151; const int mod=1e9 + 7; #define int long long const int inf=1e18; #define pii pair<int, int> #define f first #define s second #define mp make_pair #define FOR(i, n) for(int i=1;i<=n;i++) #define TRACE(x) cerr << #x << " = " << x << endl //Trace prints the name of the variable and the value. bool inc[N];int col[N]; int graph[N][N];int n; bool p(int guy, int x) { int num=1 + n-x+1; cout<<num-1<<" "; for(int i=x;i<=n;i++) cout<<i<<" ";cout<<endl; int ans, temp;cin>>temp; cout<<num<<" "<<guy<<" "; for(int i=x;i<=n;i++) cout<<i<<" ";cout<<endl; cin>>ans; return ans==temp; } signed main() { ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL); cin>>n; for(int i=1;i<=n;i++) { for(int j=1;j<=n;j++) graph[i][j]=0;inc[i]=0; col[i]=-1; } for(int i=1;i<=n;i++) { if(inc[i]) continue; int l=i+1;inc[i]=1; while(l<=n) { int r=n; while(l<r) { int mid=(l+r+1)/2; if(p(i, mid)) l=mid; else r=mid-1; } if(!p(i, l)) break; graph[i][l]=1;inc[l]=1;l++; } } int cur=1; for(int i=1;i<=n;i++) { if(col[i]!=-1) continue; col[i]=cur; for(int j=1;j<=n;j++) if(graph[i][j]) col[j]=cur; cur++; } cout<<0<<" "; for(int i=1;i<=n;i++) cout<<col[i]<<" "; cout<<endl; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 29 ms | 404 KB | Integer 12 violates the range [1, 11] |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 14 ms | 504 KB | Integer 6 violates the range [1, 5] |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 20 ms | 504 KB | Integer 2 violates the range [1, 1] |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 26 ms | 504 KB | Integer 5 violates the range [1, 4] |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 25 ms | 504 KB | Integer 3 violates the range [1, 2] |
2 | Halted | 0 ms | 0 KB | - |