제출 #485350

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