제출 #485348

#제출 시각아이디문제언어결과실행 시간메모리
485348silverfish동굴 (IOI13_cave)C++14
100 / 100
268 ms680 KiB
#include "cave.h" #include <bits/stdc++.h> using namespace std; int s[5005], curs[5005], door[5005]; void exploreCave(int N) { fill(s, s+N, -1); for(int i = 0; i < N; ++i){ fill(curs, curs+N, 0); for(int k = 0; k < N; ++k) if(~s[k]) curs[k] = s[k]; int comb = tryCombination(curs); int d = 0, state = (comb > i || comb == -1); // state = 0 : closed // state = 1 : open for(int j = 12; j >= 0; --j){ for(int k = d; k < min(d + (1<<j), N); ++k){ if(~s[k]) curs[k] = s[k]; else curs[k] = 1; } comb = tryCombination(curs); int cstate = (comb > i || comb==-1); if(cstate == state){ d += (1<<j); d = min(d, N-1); }else{ for(int k =d; k < min(d + (1<<j), N); ++k){ if(~s[k]) curs[k] = s[k]; else curs[k] = 0; } } } door[d] = i; s[d] = (state ? 0 : 1); } answer(s, door); }
#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...