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<=i;}
void exploreCave(int N){
for(;i<N;i++){
l=0,r=N-1;
if(T())A(r);
while(l<r){
m=l+r>>1;A(m);
T()?r=m,A(m):A(m),l=m+1;
}
a[l]=i,f[l]=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<=i;}
| ~~~~~~~~~~~~~~~~~^~~~~
cave.cpp: In function 'void exploreCave(int)':
cave.cpp:12:10: warning: suggest parentheses around '+' inside '>>' [-Wparentheses]
12 | m=l+r>>1;A(m);
| ~^~
# | 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... |