제출 #249678

#제출 시각아이디문제언어결과실행 시간메모리
249678muhammad_hokimiyon동굴 (IOI13_cave)C++14
76 / 100
2011 ms636 KiB
#include "cave.h" #include <bits/stdc++.h> #define fi first #define se second #define ll long long #define dl double long using namespace std; const int NN = 1e9 + 7; const int M = 26; const ll mod = 1e9 + 7; const ll inf = 1e18 + 7; const dl rf = 1e-14; mt19937 rng(chrono::steady_clock::now().time_since_epoch().count()); void exploreCave(int N) { vector < pair < int , int > > ans(N , {0 , 0}); vector < int > used(N , 0); for( int i = 0; i < N; i++ ){ int s[N] = {}; for( int j = 0; j < N; j++ ){ if( used[j] )s[j] = ans[j].se; } int x = tryCombination(s); if( x <= i && x != -1 )x = 1; else x = 0; int l = 0 , r = N - 1; while( l < r ){ int m = (l + r) / 2; int qr[N] = {}; for( int j = 0; j < N; j++ ){ if( used[j] ){ qr[j] = ans[j].se; } } for( int j = 0; j <= m; j++ ){ if( !used[j] ){ qr[j] = x; } } for( int j = m + 1; j < N; j++ ){ if( !used[j] ){ qr[j] = 1 - x; } } int xx = tryCombination(qr); if( xx > i || xx == -1 )r = m; else l = m + 1; } ans[l] = { i , x }; used[l] = 1; } int S[N]; int D[N]; for( int i = 0; i < N; i++ ){ S[i] = ans[i].se; D[i] = ans[i].fi; } 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...