제출 #148057

#제출 시각아이디문제언어결과실행 시간메모리
148057GodTe동굴 (IOI13_cave)C++14
100 / 100
413 ms484 KiB
#include <bits/stdc++.h> #include <cave.h> using namespace std; typedef long long ll; typedef pair<int, int> Pi; typedef pair<ll, ll> Pll; // #define TT() printf("%.4f sec\n", (double) clock() / CLOCKS_PER_SEC ) #define Fi first #define Se second #define rep(i, n) for(ll i=0;i<n;i++) #define repp(i, n) for(ll i=1;i<=n;i++) #define INF 1987654321 #define IINF 987654321987654321 void exploreCave(int N){ int ans[5010] = {0,}; int cntd[5010] = {0,}; rep(i,5010){ ans[i] = 0; cntd[i] = -1; } rep(i,N){ int aa = tryCombination(ans); if(aa <= i && aa >= 0){ rep(j,N) if(cntd[j] == -1) ans[j] = 1-ans[j]; } int l = 0; int r = N-1; while(l < r){ int mid = (l+r)/2; for(int j = l; j <= mid; j++){ if(cntd[j] == -1) ans[j] = 1-ans[j]; } aa = tryCombination(ans); if(aa > i || aa < 0) l = mid+1; else { for(int j = l; j <= mid; j++) if(cntd[j] == -1) ans[j] = 1-ans[j]; r = mid; } } cntd[l] = i; } answer(ans,cntd); }
#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...