제출 #555343

#제출 시각아이디문제언어결과실행 시간메모리
555343urosk동굴 (IOI13_cave)C++14
13 / 100
2079 ms468 KiB
#include "cave.h" #include <bits/stdc++.h> #define ld double #define ll int #define ull unsigned long long #define llinf 100000000000000000LL // 10^17 #define iinf 2000000000 // 2*10^9 #define pb push_back #define popb pop_back #define fi first #define sc second #define endl '\n' #define pii pair<int,int> #define pll pair<ll,ll> #define pld pair<ld,ld> #define sz(a) int(a.size()) #define all(a) a.begin(),a.end() #define ceri(a,l,r) {for(ll i_ = l;i_<=r;i_++) cerr<<a[i_]<< " ";cerr<<endl;} using namespace std; #define maxn 5005 ll n; ll a[maxn]; ll b[maxn]; ll c[maxn]; ll d[maxn]; bool vis[maxn]; void exploreCave(int N) { n = N; for(ll i = 0;i<n;i++) b[i] = -1; for(ll i = 0;i<n;i++) d[i] = -1; for(ll i = 0;i<n;i++) c[i] = 0; ll e = tryCombination(c); if(e==-1){ for(ll i = 0;i<n;i++){ c[i] = 1; int e = tryCombination(c); b[i] = e; c[i] = 0; } answer(c,b); } if(n<=2000){ ll last = 0; while(e!=n){ for(ll i = last;i<n;i++){ c[i]^=1; ll f = tryCombination(c); if(f<e){ b[i] = f; d[f] = i; vis[i] = 1; } c[i]^=1; } last = e+1; for(ll j = 0;j<n;j++){ if(b[j]!=-1) continue; if(vis[j]) continue; c[j]^=1; ll f = tryCombination(c); if(f==-1) f = n; if(f>e){ vis[j] = 1; e = f; break; } c[j]^=1; } } answer(c,b); } iota(a,a+n,0); for(ll i = 0;i<n;i++){ c[i] = 1; ll e = tryCombination(c); if(e==-1) e = n; if(e>i) c[i] = 1; else c[i] = 0; } answer(c,a); }
#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...