제출 #1024437

#제출 시각아이디문제언어결과실행 시간메모리
1024437ZHIRDILBILDIZ동굴 (IOI13_cave)C++14
100 / 100
248 ms1064 KiB
#include<bits/stdc++.h> #include"cave.h" using namespace std ; void exploreCave(int N) { vector<int> un_us, us; int S[N], D[N] ; for(int i = 0 ; i < N ; i++) un_us.push_back(i), D[i] = 0 ; for(int i = 0 ; i < N ; i++) { for(int j : un_us) S[j] = 0 ; int trycomb = tryCombination(S); if(trycomb == i) { int l = -1, r = un_us.size() ; while(l + 1 < r) { int mid = (l + r) >> 1 ; for(int j = 0 ; j <= mid ; j++) S[un_us[j]] = 1 ; if(tryCombination(S) == i)l = mid ; else r = mid ; for(int j = 0 ; j <= mid ; j++) S[un_us[j]] = 0 ; } us.push_back(un_us[r]) ; un_us.erase(r + un_us.begin()) ; D[us.back()] = i ; S[us.back()] = 1 ; } else { int l = -1, r = un_us.size() ; while(l + 1 < r) { int mid = (l + r) >> 1 ; for(int j = 0 ; j <= mid ; j++) S[un_us[j]] = 1 ; if(tryCombination(S) == i)r = mid ; else l = mid ; for(int j = 0 ; j <= mid ; j++) S[un_us[j]] = 0 ; } us.push_back(un_us[r]) ; un_us.erase(r + un_us.begin()) ; D[us.back()] = i ; S[us.back()] = 0 ; } } 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...