제출 #154676

#제출 시각아이디문제언어결과실행 시간메모리
154676mhy908동굴 (IOI13_cave)C++14
0 / 100
366 ms480 KiB
#include "cave.h" #include <bits/stdc++.h> using namespace std; int point[5010]; bool ch[5010]; int p[5010], n; int binopen(int st, int fin, int num){ if(st==fin)return st; int mid=(st+fin)/2; for(int i=st; i<=mid; i++) if(!ch[i])p[i]*=-1; int t=tryCombination(p); for(int i=st; i<=mid; i++) if(!ch[i])p[i]*=-1; if(t==num)return binopen(st, mid, num); return binopen(mid+1, fin, num); } int binclose(int st, int fin, int num){ if(st==fin)return st; int mid=(st+fin)/2; for(int i=st; i<=mid; i++) if(!ch[i])p[i]*=-1; int t=tryCombination(p); for(int i=st; i<=mid; i++) if(!ch[i])p[i]*=-1; if(t>num)return binclose(st, mid, num); return binclose(mid+1, fin, num); } void exploreCave(int N){ n=N; for(int i=0; i<n; i++){ int temp=tryCombination(p); if(temp==i){ int num=binclose(0, n-1, i); point[num]=i; ch[num]=true; p[num]*=-1; } else{ int num=binopen(0, n-1, i); point[num]=i; ch[num]=true; } } answer(point, p); }
#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...