Submission #1024433

#TimeUsernameProblemLanguageResultExecution timeMemory
1024433ZHIRDILBILDIZCave (IOI13_cave)C++14
0 / 100
2 ms1116 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; if(1 == 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(1 == 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(1 == 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...