Submission #1142751

#TimeUsernameProblemLanguageResultExecution timeMemory
1142751AmirMakaMCave (IOI13_cave)C++20
100 / 100
190 ms528 KiB
#include <bits/stdc++.h> #include "cave.h" using namespace std; #define ull unsigned long long #define ll long long #define ld long double #define pb push_back #define f first #define s second #define sz(x) (int)x.size() #define all(x) x.begin(),x.end() #define pii pair<int,int> #define pll pair<ll,ll> #define pld pair<ld,ld> #define pdd pair<double,double> #define mp make_pair #define AmirMakaM ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0) // solve it const ull SEED = chrono::steady_clock::now().time_since_epoch().count(); mt19937_64 mrand(SEED); ull rnd(ull x = ~(0ull)) {return mrand() % x;} const ll MOD = 998244353; const ll INF = 1e16+20; const int inf = 1e9 + 7; const ll N = 4e5+5; const ll M = 2e3+1; const double pi = 2*acos(0.0); const int dx[] = {1,-1,0,0}, dy[] = {0,0,1,-1}; void exploreCave(int n) { int a[n], b[n]; for(int i=0; i<n; i++) a[i] = b[i] = -1; for(int i=0; i<n; i++) { int cur[n]; for(int j=0; j<n; j++) { if(a[j] == -1) cur[j] = 0; else cur[j] = a[j]; } int cnt = tryCombination(cur); if(cnt == -1) { cnt = n+1; } int l = 0, r = n; while(r-l>1) { int mid=(l+r)>>1; for(int j=l; j<mid; j++) { if(a[j] == -1) cur[j] = 1; } int res = tryCombination(cur); if(res == -1) res = n+1; if(res > i) { if(cnt > i) l = mid; else r = mid; } else { if(cnt > i) r = mid; else l = mid; } for(int j=l; j<mid; j++) { if(a[j] == -1) cur[j] = 0; } } a[l] = !(cnt > i); b[l] = i; } answer(a,b); }
#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...