이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
#include "cave.h"
using namespace std;
const int MAXN = 5010;
int s[MAXN], d[MAXN], aux[MAXN];
void exploreCave(int n){
memset(d, -1, sizeof d);
int x = tryCombination(s);
if(x == -1) x = n;
for(int p = 0;p < n;p++){
int bg = 0, nd = n - 1;
while(bg < nd){
int mid = (bg + nd) >> 1;
for(int i = bg;i <= mid;i++)
if(d[i] == -1)
aux[i] = (aux[i] + 1) % 2;
int y = tryCombination(aux);
if(y == -1) y = n;
if((x > p && y == p) || (x == p && y > p))
x = y, nd = mid;
else
x = y, bg = mid + 1;
}
d[bg] = p;
int z = tryCombination(aux);
s[bg] = (z == p ? (aux[bg] + 1) % 2 : aux[bg]);
aux[bg] = s[bg];
if(z > p)
x = z;
else {
x = tryCombination(aux);
if(x == -1)
x = n;
}
}
answer(s, d);
}
# | 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... |