# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
962704 | 2024-04-14T07:19:11 Z | simona1230 | Cave (IOI13_cave) | C++17 | 679 ms | 600 KB |
#include <bits/stdc++.h> #include "cave.h" using namespace std; int n; int c[5000],d[5000]; int p[5000],l[5000]; int used[5000]; void exploreCave(int N) { n=N; int x=tryCombination(l); if(x==-1) { x=0; for(int i=0; i<n; i++) c[i]=1; } for(int i=0; i<n-1; i++) { /*cout<<endl; for(int j=0; j<n; j++) cout<<c[j]<<" "; cout<<endl; for(int j=0; j<n; j++) cout<<used[j]<<" "; cout<<endl; cout<<i<<" / "<<x<<endl;*/ int l=1,r=n-i; while(l!=r) { int m=(l+r)/2; int cnt=0; for(int j=0; j<n; j++) { if(!used[j]) { //cout<<"=-=- "<<j<<endl; cnt++; if(cnt>=l&&cnt<=m)p[j]=c[j]^1; else p[j]=c[j]; } else p[j]=c[j]; } int y=tryCombination(p); /*cout<<l<<" "<<m<<" "<<r<<endl; for(int j=0; j<n; j++) cout<<p[j]<<" "; cout<<endl; cout<<"* "<<y<<endl;*/ if(y==-1&&x==i||x==i&&x!=y||x>i&&x==y) { r=m; } else { l=m+1; } } int cnt=0; for(int j=0; j<n; j++) { if(!used[j]) { cnt++; if(cnt==l) { used[j]=1; if(x==i)c[j]=1^c[j]; d[j]=i; //cout<<"- "<<j<<endl; } } } x=tryCombination(c); } int lf=0; for(int j=0;j<n;j++) { if(!used[j]) { d[j]=n-1; if(x!=-1)c[j]=c[j]^1; lf=j; } } answer(c,d); }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 203 ms | 536 KB | Answer is wrong |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 426 ms | 540 KB | Output is correct |
2 | Correct | 0 ms | 348 KB | Output is correct |
3 | Correct | 404 ms | 600 KB | Output is correct |
4 | Correct | 0 ms | 344 KB | Output is correct |
5 | Correct | 1 ms | 348 KB | Output is correct |
6 | Correct | 409 ms | 516 KB | Output is correct |
7 | Correct | 414 ms | 524 KB | Output is correct |
8 | Correct | 650 ms | 548 KB | Output is correct |
9 | Correct | 679 ms | 544 KB | Output is correct |
10 | Correct | 679 ms | 548 KB | Output is correct |
11 | Correct | 379 ms | 548 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 348 KB | Output is correct |
2 | Correct | 0 ms | 348 KB | Output is correct |
3 | Correct | 1 ms | 348 KB | Output is correct |
4 | Correct | 0 ms | 348 KB | Output is correct |
5 | Incorrect | 1 ms | 348 KB | Answer is wrong |
6 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 348 KB | Output is correct |
2 | Correct | 0 ms | 348 KB | Output is correct |
3 | Correct | 1 ms | 348 KB | Output is correct |
4 | Correct | 0 ms | 348 KB | Output is correct |
5 | Incorrect | 1 ms | 348 KB | Answer is wrong |
6 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 203 ms | 536 KB | Answer is wrong |
2 | Halted | 0 ms | 0 KB | - |