Submission #135609

#TimeUsernameProblemLanguageResultExecution timeMemory
135609mirbek01Cave (IOI13_cave)C++11
0 / 100
948 ms552 KiB
#include "cave.h" //#include "grader.cpp" #include <bits/stdc++.h> using namespace std; const int MAXN = 5e3 + 2; int f[MAXN], s[MAXN], ar[MAXN], pos[MAXN]; void exploreCave(int N) { for(int i = 0; i < N; i ++){ for(int j = 0; j < N; j ++) ar[j] = 0; for(int j = 0; j < i; j ++){ ar[ pos[j] ] = f[ pos[j] ]; } int ret = tryCombination(ar); vector <int> v; for(int j = 0; j < N; j ++){ if(!s[j]) v.push_back(j); } int correct = 0; if(ret == i) correct = 1; int lo = 0, hi = (int)v.size() - 1; while(lo <= hi){ int md = (lo + hi) >> 1; if(!correct){ for(int j = md + 1; j < (int)v.size(); j ++) ar[ v[j] ] = 0; for(int j = 0; j <= md; j ++) ar[ v[j] ] = 1; } else { for(int j = md + 1; j < (int)v.size(); j ++) ar[ v[j] ] = 1; for(int j = 0; j <= md; j ++) ar[ v[j] ] = 0; } ret = tryCombination(ar); if(ret == i){ hi = md - 1; } else { lo = md + 1; } } lo = v[hi + 1]; f[lo] = correct; s[lo] = i; pos[i] = lo; } answer(f, s); }
#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...