Submission #715876

#TimeUsernameProblemLanguageResultExecution timeMemory
715876ovidiush11동굴 (IOI13_cave)C++14
100 / 100
208 ms560 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); if(last == -1)last = N; int left = 0,right = N-1; while(left != right) { int mid = (left + right) / 2; for(int j = left;j <= mid;j++)if(st[j] == 0)direction[j] = (direction[j] + 1) % 2; int x = tryCombination(direction); if(x == -1)x = N; 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[left] = i; } for(int i = 0;i < N;i++) { if(st[i] == 0) { pos[i] = N-1; last = tryCombination(direction); if(last == -1)answer(direction,pos); else {direction[i] = (direction[i] + 1) % 2; answer(direction,pos);} break; } } return ; }
#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...