Submission #284627

#TimeUsernameProblemLanguageResultExecution timeMemory
284627triplem5dsCave (IOI13_cave)C++14
0 / 100
457 ms608 KiB
#include "cave.h" #include "bits/stdc++.h" using namespace std; int ans[5005]; int S[5005]; int W[5005]; void exploreCave(int N) { memset(ans, -1, sizeof ans); vector<int> inSet; for(int i = 0; i < N; i++) inSet.push_back(i); for(int i = 0; i < N; i++){ for(int j = 0; j < N; j++)if(ans[j] == -1)S[j] = 0; else S[j] = ans[j]; int x = tryCombination(S); if(x == -1)x = N; bool f = (x <= i); ///find which switch is it int lo = 0, hi = N - 1 - i; while(lo < hi){ int md = lo + (hi - lo) / 2; int cnt = 0; for(int j = 0; j < N; j++){ if(ans[j] != -1)S[j] = ans[j]; else { S[j] = (f ^ (cnt > md)); cnt++; } } int x = tryCombination(S); if(x == -1)x = N; if(x > i) hi = md; else lo = md + 1; } ans[lo] = f; W[i] = lo; } answer(S,W); }
#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...