# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
107686 | FiloSanza | Cave (IOI13_cave) | C++14 | 1367 ms | 640 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 "cave.h"
#include <bits/stdc++.h>
using namespace std;
void setV(vector<int>& a, const vector<int>& b, int x, int y, int val){
for(int i=x; i<=y; i++) if(b[i] == -1)
a[i] = val;
}
void exploreCave(int N) {
vector<int> pos(N, -1);
vector<int> ans(N, -1);
vector<int> idx(N, -1);
for(int i=0; i<N; i++){
//cerr << i << "\n";
int lo = 0, hi = N-1, val = 0, x;
setV(pos, ans, lo, hi, val);
int dist = tryCombination(pos.data());
if(dist == - 1) dist = N;
if(dist < i+1) val = 1, setV(pos, ans, lo, hi, val);
while(lo < hi){
int mid = (lo+hi)/2;
setV(pos, ans, lo, mid, val^1);
int dist = tryCombination(pos.data());
if(dist == -1) dist = N;
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... |