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 <bits/stdc++.h>
#include "cave.h"
using namespace std;
int n, *s, *t;
void exploreCave(int N) {
n = N;
s = new int[n];
t = new int[n];
//Initializing
for(int i = 0; i < n; i++){
t[i] = -1;
s[i] = 0;
}
//Subtask 1
// for(int i = 0; i < n; i++){
// int c = tryCombination(s);
// if(c == -1) break;
// s[c] = 1 - s[c];
// }
int j = 0;
while(j < n){
int normal_state = tryCombination(s);
for(int i = 0; i < n; i++){
if(t[i] != -1) continue;
s[i] = 1 - s[i]; //Alternation
int attempt = tryCombination(s);
if(attempt != normal_state){
if(attempt == j){
s[i] = 1 - s[i];
t[i] = j;
j++;
break;
}
if(normal_state == j){
t[i] = j;
j++;
break;
}
}
s[i] = 1 - s[i];
}
}
answer(s, t);
}
# | 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... |