Submission #992866

#TimeUsernameProblemLanguageResultExecution timeMemory
992866vqpahmadCave (IOI13_cave)C++14
0 / 100
1 ms344 KiB
#include<bits/stdc++.h> #include "cave.h" using namespace std; #ifdef ONPC #include"debug.h" #else #define debug(...) 42 #endif #define ll long long #define pii pair<int,int> #define F first #define S second #define pb push_back #define sz(a) (int)a.size() #define all(a) a.begin(),a.end() template<class T> bool ckmin(T& a, const T& b) { return b < a ? a = b, 1 : 0; } template<class T> bool ckmax(T& a, const T& b) { return a < b ? a = b, 1 : 0; } const int mod = 1e9 + 7; const int MAXN = 1e6 + 15; const int inf = 0x3f3f3f3f; const ll INF = 0x3f3f3f3f3f3f3f3f; int ask(int s[]){ return tryCombination(s); } void exploreCave(int n) { int s[n] = {}; int b[n] = {}; int p[n] = {}; for (int i = 0; i < n; i++) b[i] = -1; for (int i = 0; i < n; i++){ for (int j = 0; j < n; j++){ s[i] = (b[i] == -1 ? 0 : b[i]); } int f = ask(s); if (f == -1) f = n; int v = !(f >= i); int lo = i - 1, hi = n - 1; while (hi - lo > 1){ int mi = (lo + hi) / 2; for (int j = 0; j <= mi; j++){ s[i] = (b[i] == -1 ? v : b[i]); } for (int j = mi + 1; j < n; j++){ s[i] = (b[i] == -1 ? (v^1) : b[i]); } f = ask(s); if (f == -1) f = n; if (f >= i){ hi = mi; } else { lo = mi; } } b[hi] = v; p[hi] = i; } answer(s, p); return ; }
#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...