제출 #231436

#제출 시각아이디문제언어결과실행 시간메모리
231436Tehillah동굴 (IOI13_cave)C++14
13 / 100
2090 ms944 KiB
#include "cave.h" #include <map> using namespace std; #define REP(i, a, b) for(int i=(int)(a); i<(int)(b); ++i) void exploreCave(int N) { // vector<int> S(N, 1), D(N); int S[N], D[N]; for(int i=0; i<N; ++i) S[i] = 1; int ret, f; map<int, int> done; while(1) { ret = tryCombination(S); int end = ret; if(ret == -1) { f=1; break; } int p = end+1; // cout << "start...\n"; f=0; REP(i, 0, N) { if(done[i]) continue; //flip ith switch S[i] = !S[i]; ret = tryCombination(S); if(ret == -1) { f=1;break; } if(ret < end) { D[i] = ret; S[i] = !S[i]; done[i] = 1; --p; } else if(ret == end) { D[i] = ret; done[i] = 1; --p; } else S[i] = !S[i]; if(p == 0) break; } // cout << "end...\n"; if(end == N || f) break; } if(f) REP(i, 0, N) { S[i] = !S[i]; ret = tryCombination(S); // assert(ret != -1); D[i] = ret; S[i] = !S[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...