Submission #761498

#TimeUsernameProblemLanguageResultExecution timeMemory
761498Noble_MushtakCave (IOI13_cave)C++14
0 / 100
2 ms340 KiB
#include "cave.h" #include <bits/stdc++.h> using num = int64_t; using namespace std; #define rep(i, a, b) for(num i = a; i < (b); ++i) #define REPI(t, n) for (num t = 0; t < n; ++t) #define all(x) begin(x), end(x) #define sz(x) (int)(x).size() using ll = long long; using pii = pair<int, int>; using vi = vector<int>; #ifdef TESTING #define DEBUG(...) __VA_ARGS__ #else #define DEBUG(...) #endif void exploreCave(int N) { vector<int> S(N); REPI(i, N) S[i] = 0; auto curClosestDoor = tryCombination(S.data()); vector<int> D(N, -1); REPI(i, N) { int lo = 0, hi = N-1; while (lo <= hi) { int mid = (lo+hi)/2; rep(j, lo, mid+1) { if (D[j] == -1) S[j] = 1; } auto newClosestDoor = tryCombination(S.data()); rep(j, lo, mid+1) { if (D[j] == -1) S[j] = 0; } if ((newClosestDoor == i) ^ (curClosestDoor == i)) hi = mid; else lo = mid+1; } D[lo] = i; if (curClosestDoor == i) { S[lo] = 1; curClosestDoor = tryCombination(S.data()); } } answer(S.data(), D.data()); }
#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...