This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include "cave.h"
#include <bits/stdc++.h>
using namespace std;
int c[5003],f[5003],a[5003],i,j,x,l,r,m;
void A(int r){for(;r>=l;r--)c[r]^=!f[r];}
int T(){return tryCombination(c)+8192&8191;}
void exploreCave(int N){
for(;i<N;i++){
l=0,r=N-1;
if(T()<=i)A(r);
while(l<=r){
m=l+r>>1;
A(m);
T()<=i?a[i]=m,r=m-1,A(m):A(m),l=m+1;
}
f[a[i]]=1;
}
answer(c,a);
}
Compilation message (stderr)
cave.cpp: In function 'int T()':
cave.cpp:6:33: warning: suggest parentheses around '+' in operand of '&' [-Wparentheses]
6 | int T(){return tryCombination(c)+8192&8191;}
| ~~~~~~~~~~~~~~~~~^~~~~
cave.cpp: In function 'void exploreCave(int)':
cave.cpp:12:10: warning: suggest parentheses around '+' inside '>>' [-Wparentheses]
12 | m=l+r>>1;
| ~^~
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |