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