제출 #97109

#제출 시각아이디문제언어결과실행 시간메모리
97109E869120동굴 (IOI13_cave)C++14
0 / 100
561 ms488 KiB
#include "cave.h" #include <bits/stdc++.h> using namespace std; int S[5000], A[5009], B[5009], col[5009]; void exploreCave(int N) { for (int i = 0; i < N; i++) col[i] = -1; for (int i = 0; i < N; i++) { for (int j = 0; j < N; j++) { if (col[j] == -1) S[j] = 0; else S[j] = col[j]; } int Z = tryCombination(S); int L = 0, R = N, M, res = 0; while (R - L >= 2) { M = (L + R) / 2; for (int j = 0; j < N; j++) { if (col[j] == -1) { if (L <= j && j < M) S[j] = 1; else S[j] = 0; } else S[j] = col[j]; } int ZZ = tryCombination(S); bool ok1 = true; if (Z == i) ok1 = false; bool ok2 = true; if (ZZ == i) ok2 = false; if (ok1 != ok2) { res = L; R = M; } if (ok1 == ok2) { res = M; L = M; } } if (Z == i) { // This switch should be 1. col[res] = 1; A[i] = res; B[i] = 1; } else { // THis switch should be 0. col[res] = 0; A[i] = res; B[i] = 0; } } answer(A, B); }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...