제출 #899284

#제출 시각아이디문제언어결과실행 시간메모리
899284nasir_bashirov동굴 (IOI13_cave)C++11
0 / 100
444 ms544 KiB
#include "cave.h" #include <bits/stdc++.h> using namespace std; #define db long double #define ll long long #define pii pair<int, int> #define pll pair<ll, ll> #define vi vector<int> #define vl vector<ll> #define vii vector<pii> #define vll vector<pll> #define endl '\n' #define all(x) x.begin(), x.end() #define fastio\ ios_base::sync_with_stdio(0);\ cin.tie(0);\ cout.tie(0)\ void exploreCave(int n){ int type[n], ind[n], qry[n]; vi done(n, 0); for(int i = 0; i < n; i++){ int l = 0, r = n - 1, index = -1, p = -1; for(int j = 0; j < n; j++){ if(done[j]){ qry[j] = type[j]; } else{ qry[j] = 0; } } int qq = tryCombination(qry); if(qq >= i + 1 or (qq == -1 and i)){ p = 0; } else{ p = 1; } while(l <= r){ int mid = (l + r) / 2; for(int j = 0; j < n; j++){ if(done[j]) qry[j] = type[j]; else if(j >= l and j <= mid) qry[j] = p; else qry[j] = 1 - p; } int qq = tryCombination(qry); if(qq >= i + 1 or (qq == -1 and i)){ r = mid - 1; index = mid; } else{ l = mid + 1; } } done[index] = 1; type[index] = p; ind[index] = i; } answer(type, ind); }
#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...