Submission #984102

#TimeUsernameProblemLanguageResultExecution timeMemory
984102Zbyszek99Cave (IOI13_cave)C++17
100 / 100
502 ms860 KiB
#include "cave.h" #include <bits/stdc++.h> using namespace std; int stan[5000]; int matching[5000]; int is_set[5000]; int try_[5000]; void exploreCave(int N) { for(int i = 0; i < N; i++) { for(int j = 0; j < N; j++) { try_[j] = stan[j]; } int ans = tryCombination(try_); int s = 0; if(ans == i) { s = 1; } int pocz = 0; int kon = N-1; while(pocz < kon) { int srod = (pocz+kon)/2; for(int j = 0; j < N; j++) { if(is_set[j] == 1) try_[j] = stan[j]; else { if(j <= srod) try_[j] = s; else try_[j] = s ^ 1; } } if(tryCombination(try_) == i) { pocz = srod+1; } else { kon = srod; } } is_set[kon] = 1; stan[kon] = s; matching[kon] = i; } answer(stan,matching); }
#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...