Submission #107686

#TimeUTC-0UsernameProblemLanguageResultExecution timeMemory
1076862019-04-25 12:51:15FiloSanzaCave (IOI13_cave)C++14
100 / 100
1367 ms640 KiB
#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;
 
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

Compilation message (stderr)

cave.cpp: In function 'void exploreCave(int)':
cave.cpp:18:40: warning: unused variable 'x' [-Wunused-variable]
         int lo = 0, hi = N-1, val = 0, x;
                                        ^
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...