제출 #1042144

#제출 시각아이디문제언어결과실행 시간메모리
1042144blackslex동굴 (IOI13_cave)C++17
100 / 100
256 ms608 KiB
#include "cave.h" #include<bits/stdc++.h> using namespace std; void exploreCave(int N) { int D[N] = {}, val[N] = {}, pos[N] = {}, revpos[N] = {}; for (int i = 0; i < N; i++) D[i] = val[i] = 0; for (int i = 0; i < N; i++) { int ct = tryCombination(val); if (ct > i || !(~ct)) { int l = 0, r = N - 1; while (l < r) { int mid = (l + r) >> 1; for (int j = 0; j <= mid; j++) D[j] = 0; for (int j = mid + 1; j < N; j++) D[j] = 1; for (int j = 0; j < i; j++) D[pos[j]] = val[pos[j]]; int cval = tryCombination(D); if (cval > i || !(~cval)) r = mid; else l = mid + 1; } pos[i] = l; revpos[l] = i; } else { int l = 0, r = N - 1; while (l < r) { int mid = (l + r) >> 1; for (int j = 0; j <= mid; j++) D[j] = 1; for (int j = mid + 1; j < N; j++) D[j] = 0; for (int j = 0; j < i; j++) D[pos[j]] = val[pos[j]]; int cval = tryCombination(D); if (cval > i || !(~cval)) r = mid; else l = mid + 1; } pos[i] = l; revpos[l] = i; val[l] = 1; } } answer(val, revpos); }
#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...