Submission #715841

#TimeUsernameProblemLanguageResultExecution timeMemory
715841ovidiush11Cave (IOI13_cave)C++14
0 / 100
104 ms388 KiB
#include <bits/stdc++.h> #include "cave.h" using namespace std; void exploreCave(int N) { int st[N]={0},direction[N]={0},pos[N]={0}; int last; for(int i = 0;i < N-1;i++) { last = tryCombination(direction); int left = 0,right = N-1; while(left != right) { int mid = (left + right) / 2; for(int j = left;j < mid;j++)if(st[i] == 0)direction[i] = (direction[i] + 1) % 2; int x = tryCombination(direction); if((x > i && last > i) || (x <= i && last <= i))left = mid+1; else right = mid; last = x; } if(last <= i)direction[left] = (direction[left] + 1) % 2; st[left] = 1; pos[i] = left; } for(int i = 0;i < N;i++) { if(st[i] == 0) { pos[N-1] = i; last = tryCombination(direction); if(last == -1)answer(direction,pos); direction[i] = (direction[i] + 1) % 2; answer(direction,pos); } } }
#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...