제출 #29826

#제출 시각아이디문제언어결과실행 시간메모리
29826kavun동굴 (IOI13_cave)C++14
46 / 100
35 ms640 KiB
#include "cave.h" #include <bits/stdc++.h> using namespace std; int n, s[5010], firstclosed, d[5010], correct[5010], done; bool mk[5010]; void exploreCave(int N) { n = N; firstclosed = tryCombination(s); if(firstclosed == -1) firstclosed = n; for(int i = 0; done < n; i = (i+1) % n) { if(mk[i]) continue; s[i] ^= 1; int pos = tryCombination(s); if(pos == -1) { correct[i] = s[i]; d[i] = firstclosed; done++; firstclosed = n; mk[i] = true; continue; } if(pos < firstclosed) { correct[i] = s[i] ^ 1; d[i] = pos; done++; s[i] ^= 1; mk[i] = true; } if(pos > firstclosed) { correct[i] = s[i]; d[i] = firstclosed; done++; firstclosed = pos; mk[i] = true; } } for(int i = 0; i < n; i++) s[i] = correct[i]; 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...