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 n,s[5000],d[5000];
// int tryCombination(int S[]){
// for(int i = 0; i < n; ++i)
// cout << S[i] << " ";
// cout << endl;
// int ans; cin >> ans;
// return ans;
// }
// void answer(int S[],int D[]){
// for(int i = 0; i < n; ++i)
// cout << S[i] << " ";
// cout << endl;
// for(int i = 0; i < n; ++i)
// cout << D[i] << " ";
// cout << endl;
// }
void getd(){
for(int i = 0; i < n; ++i){
s[i] = 1-s[i];
int dor = tryCombination(s);
d[i] = dor, s[i] = 1-s[i];
}
}
void exploreCave(int N){
n = N;
// cin >> n;
bool fl = 0;
for(int i = 0; i < n; ++i)
s[i] = 0;
for(int i = 0; i < n; ++i){
int dor = tryCombination(s);
if(dor == -1){
fl = 1;
break;
}
int l = 0, r = n;
while(r-l > 1){
int md = (l+r)>>1;
for(int j = l; j < md; ++j)
s[j] = 1-s[j];
int ndor = tryCombination(s);
if(ndor == -1){
fl = 1;
break;
}
if(dor == ndor)
l = md;
else{
r = md;
for(int j = l; j < md; ++j)
s[j] = 1-s[j];
}
}
if(fl)
break;
d[l] = dor, s[l] = 1-s[l];
}
if(fl){
getd();
}
answer(s,d);
return;
}
// int main(){
// exploreCave(0);
// return 0;
// }
# | 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... |