Submission #107553

#TimeUsernameProblemLanguageResultExecution timeMemory
107553shoemakerjoCave (IOI13_cave)C++14
0 / 100
245 ms492 KiB
#include "cave.h" #include <bits/stdc++.h> using namespace std; int *s, *d; void exploreCave(int N) { /* ... */ s = new int[N]; d = new int[N]; vector<int> curin; for (int i = 0; i < N; i++) { curin.push_back(i); } for (int i = 0; i < N; i++) { //set all to 0 int cv = 0; for (int v : curin) { s[v] = 0; } int val = tryCombination(s); if (val == i) { cv = 1; } int l = 0, r = curin.size()-1; while (l != r) { int mid = (l + r)/2; //try doing all from l to r for (int j = mid+1; j <= r; j++) { s[curin[j]] = 1-cv; } if (tryCombination(s) == i) { //this means that the left has the ans r = mid; } else { for (int j = mid+1; j <= r; j++) { s[curin[j]] = cv; l = mid+1; } } } s[curin[l]] = cv; d[curin[l]] = i; curin.erase(curin.begin() + l); } answer(s, d); }
#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...