Submission #483279

#TimeUsernameProblemLanguageResultExecution timeMemory
483279MohamedAliSaidaneCave (IOI13_cave)C++14
0 / 100
40 ms332 KiB
#include <bits/stdc++.h> #include "cave.h" using namespace std; typedef long long ll; typedef unsigned long long ull; typedef pair<int,int> pii; typedef pair<ll,ll> pll; typedef vector<int> vi; typedef vector<ll> vll; #define pb push_back #define pop pop_back #define ff first #define ss second const ll MOD = 1e9 + 7; const ll INF = 1e18; int n; void exploreCave(int N) { n = N; int cb[n]; memset(cb,0,sizeof(cb)); int d[n]; memset(d,0,sizeof(d)); bool locked[n]; memset(locked,false,sizeof(locked)); for(int door = 0; door <n; door ++) { int u = tryCombination(cb); int debut = 0; int fin = n-1; bool flag = u == door; int ans = 0; while(debut <= fin) { int mid = (debut+fin)/2; for(int j = mid; j <= fin; j ++) { if(locked[j]) continue; cb[j] = 1 - cb[j]; } int nv = tryCombination(cb); if(nv == u ) { if(!flag) { debut = mid + 1; ans = mid; } else fin = mid - 1; } else { if(flag) { debut = mid + 1; ans = mid; } else fin = mid - 1; } for(int j = mid; j <= fin; j ++) { if(locked[j]) continue; cb[j] = 1 - cb[j]; } } cb[ans] = flag; locked[ans]= true; } answer(cb,d); return ; }
#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...