제출 #499566

#제출 시각아이디문제언어결과실행 시간메모리
499566MateGiorbelidze동굴 (IOI13_cave)C++14
0 / 100
26 ms372 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=0; 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 ; for (int i=0; i<N; i++) { if ( used [ i ] == 0) s[i] = val; } } 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...