제출 #98802

#제출 시각아이디문제언어결과실행 시간메모리
98802Alexa2001동굴 (IOI13_cave)C++17
100 / 100
401 ms668 KiB
#include "cave.h" #include <bits/stdc++.h> const int Nmax = 5005; using namespace std; int a[Nmax], ans[Nmax]; bool used[Nmax]; int eh(int x) { if(x == -1) return Nmax; return x; } void exploreCave(int N) { int i, j, x; vector<int> v; for(i=0; i<N; ++i) { v.clear(); for(j=0; j<N; ++j) if(!used[j]) v.push_back(j); for(auto it : v) a[it] = 0; if(eh(tryCombination(a)) > i) x = 0; else x = 1; int st, dr, mid; st = 0; dr = v.size() - 1; while(st < dr) { mid = (st+dr) / 2; for(j=st; j<=mid; ++j) a[v[j]] = x; for(j=mid+1; j<=dr; ++j) a[v[j]] = x ^ 1; if(eh(tryCombination(a)) > i) dr = mid; else st = mid+1; } st = v[st]; used[st] = 1; a[st] = x; ans[st] = i; } answer(a, ans); }
#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...