제출 #144911

#제출 시각아이디문제언어결과실행 시간메모리
144911youssefbou62동굴 (IOI13_cave)C++14
0 / 100
38 ms384 KiB
#include <bits/stdc++.h> #include "cave.h" using namespace std; #define mp make_pair #define fi first #define se second #define all(v) v.begin(),v.end() #define allarr(a) a , a + n #define ll long long #define ull unsigned long long #define pb push_back #define fastio ios_base::sync_with_stdio(false) ; cin.tie(NULL); cout.tie(NULL) typedef pair<int, int> pi; typedef pair<ll,ll> pll; typedef pair<int,pi> trp ; typedef vector<pi> vpi; typedef vector<pll> vpll ; // int ab (int x ) { return (x>0?x:-x); } int n ,reply; int cnt = 0 ; int door[5005],Comb[5005]; int TryCombination(int S[]){ cnt++; return tryCombination(S); } void rev(int l , int r ){ for(int i = l ; i <= r ; i++ )if( door[i]==-1)Comb[i]=!Comb[i]; } void exploreCave(int N){ n = N ; memset(door,-1,sizeof door); memset(Comb,0,sizeof Comb); for(int T = 0 ; T < N ; T++ ){ int FI = tryCombination(Comb); reply = FI ; if( reply == -1 )break ; int l = 0 , r =N-1 ; while ( l < r ){ int mid = (l+r)/2; rev(l,mid); reply = tryCombination(Comb); rev(l,mid); if( reply == FI )l = mid ; else r = mid ; } assert(reply == -1 || l == r ); if( l == r )door[l]=reply; } for(int i = 0 ; i < n ; i++ )if( door[i]==-1 ){ rev(i,i); reply = tryCombination(Comb); rev(i,i); door[i]=tryCombination(Comb); } answer(Comb,door); }
#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...