Submission #594529

#TimeUsernameProblemLanguageResultExecution timeMemory
594529Koosha_mvPark (JOI17_park)C++14
0 / 100
31 ms468 KiB
#include "park.h" #include <bits/stdc++.h> using namespace std; #define dbgv(v) cout<<#v<<" = "; f(i,0,v.size()) cout<<v[i]<<" "; cout<<endl #define dbga(a,x,y) cout<<#a<<" = "; f(i,x,y) cout<<a[i]<<" "; cout<<endl #define erorp(x) cout<<#x<<"={"<<x.F<<" , "<<x.S<<"}"<<endl #define eror(x) cout<<#x<<'='<<(x)<<endl #define f_(i,a,b) for(int i=a;i>=b;i--) #define f(i,a,b) for(int i=a;i<b;i++) #define nb(x) __builtin_popcount(x) #define all(v) v.begin(),v.end() #define bit(n,k) (((n)>>(k))&1) #define Add(x,y) x=(x+y)%mod #define maxm(a,b) a=max(a,b) #define minm(a,b) a=min(a,b) #define lst(x) x[x.size()-1] #define sz(x) int(x.size()) #define mp make_pair #define ll long long #define pb push_back #define S second #define F first const int N=1505; mt19937 rng(time(nullptr)); int n,place[N]; vector<int> g[N]; void reset(){ f(i,0,n) place[i]=0; } int rand(int l,int r){ uniform_int_distribution<int> rnd(l,r-1); return rnd(rng); } void path(int s,int t,vector<int> vec){ if(vec.size()==0){ Answer(s,t); g[s].pb(t); g[t].pb(s); return ; } int id=vec[rand(0,vec.size())]; reset(); place[s]=place[t]=1; for(auto x : vec){ place[x]=1; } vector<int> L,R; for(auto x : vec){ if(x==id) continue ; place[x]=0; if(Ask(s,id,place)==0) L.pb(x); else R.pb(x); place[x]=1; } path(s,id,L); path(id,t,R); } void Detect(int T, int _n) { n=_n; vector<int> vec(n-2); iota(all(vec),1); path(0,n-1,vec); }
#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...