| # | Time | Username | Problem | Language | Result | Execution time | Memory |
|---|---|---|---|---|---|---|---|
| 1340677 | nickolasarapidis | Cave (IOI13_cave) | C++20 | 0 ms | 0 KiB |
#include "cave.h"
#include <bits/stdc++.h>
using namespace std;
const int MAXN = 5000;
void exploreCave(int N){
int S[N], D[N];
memset(S, 0, sizeof(S));
memset(D, -1, sizeof(D));
for(int i = 0; i < N; i++){
int l = 0, r = N - 1;
int B = trycombination(S);
while(l < r){
int m = (l + r)/2; int L = l;
for(int j = l; j < m; j++){
if(D[i] == -1) S[i] = 1;
}
int A = tryCombination(C);
if(A > i or A == -1){
if(B == i) r = m;
else l = m + 1;
}
else{
if(B == i) l = m + 1;
else r = m;
}
for(int j = L; j < m; j++){
if(D[i] == -1) S[i] = 0;
}
}
D[i] = l;
if(B == i) S[i] = 1;
else S[i] = 0;
}
answer(S, D);
}
