이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include "cave.h"
#include <bits/stdc++.h>
using namespace std;
#define db long double
#define ll long long
#define pii pair<int, int>
#define pll pair<ll, ll>
#define vi vector<int>
#define vl vector<ll>
#define vii vector<pii>
#define vll vector<pll>
#define endl '\n'
#define all(x) x.begin(), x.end()
#define fastio\
ios_base::sync_with_stdio(0);\
cin.tie(0);\
cout.tie(0)\
void exploreCave(int n){
int type[n], ind[n], qry[n];
map<int, int> done;
for(int i = 0; i < n; i++){
int l = 0, r = n - 1, index, p;
for(int j = 0; j < n; j++){
if(done.count(j)){
qry[j] = done[j];
}
else{
qry[j] = 0;
}
}
if(tryCombination(qry) >= i + 1){
p = 0;
}
else{
p = 1;
}
for(int j = 0; j < n; j++){
if(done.count(j)){
qry[j] = done[j];
}
else{
qry[j] = 1 - p;
}
}
while(l <= r){
int mid = (l + r) / 2;
for(int j = 0; j < n; j++){
if(done.count(j)){
qry[j] = done[j];
}
else{
qry[j] = 1 - p;
}
}
for(int j = l; j <= mid; j++){
qry[j] = p;
}
for(int j = mid + 1; j <= r; j++){
qry[j] = 1 - p;
}
if(tryCombination(qry) >= i + 1){
r = mid - 1;
index = mid;
}
else{
l = mid + 1;
}
}
done[index] = p;
type[index] = p;
ind[index] = i;
}
answer(type, ind);
}
# | 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... |