Submission #917800

#TimeUsernameProblemLanguageResultExecution timeMemory
917800MackerCave (IOI13_cave)C++14
0 / 100
382 ms348 KiB
#include "cave.h" #include <bits/stdc++.h> using namespace std; typedef long long ll; #define all(v) v.begin(), v.end() //#pragma GCC optimize("Ofast") //#pragma GCC target("avx2") void exploreCave(int N) { vector<int> doorIds(N); vector<int> rightPos(N, -1); for (int i = 0; i < N; i++) { int comb[N]; for (int j = 0; j < N; j++) { comb[j] = rightPos[j]; if(comb[j] == -1) comb[j] = 0; } bool base = !(tryCombination(comb) > i); int l = 0, r = N - 1, mid; while(l < r){ mid = (l + r) / 2; for (int j = 0; j < N; j++) { comb[j] = rightPos[j]; if(comb[j] == -1){ if(j <= mid) comb[j] = base; else comb[j] = base ^ 1; } } int x = tryCombination(comb); if(x > i || x == -1) r = mid; else l = mid + 1; } doorIds[i] = l; rightPos[l] = base; } int ansId[N], ansR[N]; for (int i = 0; i < N; i++) { ansId[doorIds[i]] = i; ansR[i] = rightPos[i]; } answer(ansR, ansId); }
#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...