이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#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... |