Submission #856527

#TimeUsernameProblemLanguageResultExecution timeMemory
856527IS_RushdiCave (IOI13_cave)C++17
12 / 100
141 ms604 KiB
#include<bits/stdc++.h> #include "cave.h" using namespace std; void exploreCave(int n) { int a[n],b[n]; for(int i = 0; i < n; i++){ a[i] = -1; b[i] = -1; } for(int i = 0; i < n; i++){ int num = 0; for(int j = 0; j < n; j++){ if(b[j] == -1) a[i] = 0; } int ask = tryCombination(a); if(ask == -1) ask = n+1; if(ask <= i) num = 1; int l = 0,r=n-1; int idx = -1; while(l <= r){ int m = (l+r)/2; for(int i = l; i <= m; i++){ if(b[i] == -1){a[i] = num;idx = i;} }for(int i = m+1; i <= r; i++){ if(b[i] == -1) a[i] = 1-num; } int ask = tryCombination(a); if(ask == -1) ask = n+1; if(ask <= i) l = m+1; else r = m-1; } a[idx] = num; b[idx] = i; } answer(a,b); }
#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...