이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include "cave.h"
#include <bits/stdc++.h>
using namespace std;
#define form2(i, a, b) for (int i = (a); i < (b); ++i)
#define ford2(i, a, b) for (int i = (a-1); i >= (b); --i)
#define form(i, n) form2(i, 0, n)
#define ford(i, n) ford2(i, n, 0)
#define chmax(x, v) x = max(x, (v))
#define chmin(x, v) x = min(x, (v))
#define fi first
#define se second
const long long BIG = 1000000000000000000LL;
typedef long long ll;
typedef long double ld;
typedef pair<int, int> pii;
int nbBlocs;
const int maxPortes = 5005;
int bloc[maxPortes];
int blocToPorte[maxPortes];
void det(int i)
{
int rt = tryCombination(bloc);
bool w = (rt == i);
int l = 0, r = nbBlocs-1;
while (l < r) {
int m = (l+r) / 2;
form(w, m+1) {
if (blocToPorte[w] == -1) bloc[w] ^= 1;
}
bool rd = (tryCombination(bloc) == i);
bool change = rd^w;
if (change) { r=m; }
else { l=m+1; }
form(w, m+1) if (blocToPorte[w] == -1) bloc[w] ^= 1;
}
blocToPorte[l] = i;
if (rt == i) bloc[l] ^= 1;
}
void exploreCave(int N)
{
fill_n(&blocToPorte[0], 5005, -1);
nbBlocs = N;
form(i, N) det(i);
answer(bloc, blocToPorte);
}
# | 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... |