# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1121297 | PagodePaiva | Cave (IOI13_cave) | C++17 | 45 ms | 596 KiB |
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;
const int N = 5000;
int c[N];
int d[N];
void exploreCave(int n) {
int ask[n];
for(int i = 0;i < n;i++){
ask[i] = 0;
}
int t = tryCombination(ask);
vector <int> v;
for(int i = 0;i <n;i++){
v.push_back(i);
}
for(int i = 0;i < n;i++){
int l = 0, r = v.size()-1;
while(l < r){
int mid = (l+r)/2;
for(int j = l;j <= mid;j++){
ask[v[j]] ^= 1;
}
int tt = tryCombination(ask);
if(t == i and tt == i){
l = mid+1;
}
else if(t == i and tt != i){
r = mid;
}
else if(t != i and tt != i){
l = mid+1;
}
else{
r = mid;
}
t = tt;
}
c[i] = v[l];
if(t == i) d[i] = ask[i];
else{
ask[i] ^= 1;
d[i] = ask[i];
}
vector <int> vv;
for(int j = 0;j < v.size();j++){
if(i == v[j]) continue;
vv.push_back(v[j]);
}
v = vv;
}
int res1[n], res2[n];
for(int i = 0;i < n;i++){
res1[i] = c[i];
res2[i] = d[i];
}
answer(res1, res2);
return;
}
Compilation message (stderr)
# | 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... |