제출 #499565

#제출 시각아이디문제언어결과실행 시간메모리
499565MateGiorbelidze동굴 (IOI13_cave)C++14
0 / 100
2 ms436 KiB
#include "cave.h" #include <bits/stdc++.h> using namespace std; #define ll int #define sc second #define ff first #define pb push_back #define in insert void exploreCave(int N) { int s[N+1],d[N+1],used[N+1],ans=0,sl=0,val=1,swp=0; for (int i=1; i<=N; i++) { d[i]=-1; s[i]=1; used[i] = 0; } while (ans!=-1) { ans=tryCombination(s); for (int i=sl; i<ans; i++) { ll l=0,r=N-1; while (l < r) { ll mid = ( l + r + 1 ) / 2; for (int j = mid; j < N; j ++ ) { if (used[j] == 0) s[j] = swp; } ll cur = tryCombination(s); for (int j = mid; j < N; j ++ ) { if (used[j] == 0) s[j] = val; } if (cur != ans) { r = mid - 1; } else l = mid; } used[l] = 1; s [l] = val ; d [l] = i; } if (val == 1) { val = 0; swp = 1; } else { val = 1; swp = 0; } sl = ans ; } answer(s,d); }
#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...