제출 #838375

#제출 시각아이디문제언어결과실행 시간메모리
838375jasmin동굴 (IOI13_cave)C++17
0 / 100
422 ms444 KiB
//IOI 2013 #include "cave.h" #include<bits/stdc++.h> using namespace std; int ask(int m, int good, int n, vector<int>& x, int comb[], int connect[]){ int ask[n]; for(int i=0; i<n; i++){ if(connect[i] != -1){ ask[i] = comb[i]; } } for(int i=0; i<=m; i++){ comb[x[i]] = good; } for(int i=m+1; i<(int)x.size(); i++){ comb[x[i]] = 1-good; } return tryCombination(ask); } void exploreCave(int N) { const int n=N; vector<int> x(n); iota(x.begin(), x.end(), 0); int comb[n]; int connect[n]; for(int i=0; i<n; i++){ connect[i] = -1; } for(int i=0; i<n; i++){ int door = tryCombination(comb); int good=0; if(door == i){ good = 1; } int l=0; int r=x.size()-1; int ans=0; while(l<=r){ int m=l+(r-l)/2; if(i < ask(m, good, n, x, comb, connect)){ ans = m; r = m-1; } else{ l = m+1; } } comb[x[ans]] = good; connect[x[ans]] = i; x.erase(x.begin() + ans); } answer(comb, connect); }
#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...