This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#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[j] = (b[j] == -1 ? 0 : b[j]);
}
int f = ask(s);
if (f == -1) f = n;
int v = !(f > i);
int lo = -1, hi = n - 1;
while (hi - lo > 1){
int mi = (lo + hi) / 2;
for (int j = 0; j <= mi; j++){
s[j] = (b[j] == -1 ? v : b[j]);
}
for (int j = mi + 1; j < n; j++){
s[j] = (b[j] == -1 ? (v^1) : b[j]);
}
f = ask(s);
if (f == -1) f = n;
if (f > i){
hi = mi;
} else {
lo = mi;
}
}
b[hi] = v;
p[hi] = i;
}
answer(b, p);
return ;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |