이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include<bits/stdc++.h>
#include "cave.h"
using namespace std;
#define pb push_back
constexpr int maxn = 5010;
int correspond[maxn], a[maxn], state[maxn];
vector<int> livre;
void exploreCave(int n) {
for(int i = 0; i < n; i++)
livre.pb(i);
for(int i = 0; i < n; i++) {
for(int j = 0; j < n; j++)
a[j] = state[j];
int now = tryCombination(a);
now = now>i||now==-1;
int l = 0, r = n-1-i;
while(l < r) {
int m = (l+r) >> 1;
for(int j = l; j <= m; j++)
a[livre[j]] ^= 1;
int opa = tryCombination(a);
opa = opa>i||opa==-1;
if(opa != now)
r = m, now = opa;
else l = m+1;
}
correspond[livre[l]] = i;
state[livre[l]] = 1^now^a[livre[l]];
livre.erase(livre.begin()+l);
}
answer(state, correspond);
}
# | 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... |