Submission #1000110

#TimeUsernameProblemLanguageResultExecution timeMemory
1000110DzadzoIsland Hopping (JOI24_island)C++17
6 / 100
9 ms596 KiB
#include <bits/stdc++.h> #include "island.h" #define ll long long #define pb push_back #define S second #define F first #define pii pair<int,int> #define vi vector <int> #define vvi vector <vi> #define vvvi vector <vvi> #define vp vector <pii> #define vvp vector <vp> #define vb vector <bool> #define vvb vector <vb>; #define INF LLONG_MAX #define MOD 1000000007 #define MAXN 300 using namespace std; /*int query(int v,int k){ cout<<v<<" "<<k<<"ask\n"; int res; cin>>res; return res; } void answer(int x,int y){ cout<<x<<" "<<y<<"edgee\n"; } */ int par[MAXN+1]; vp active(MAXN+1); int n; void add(int x){ int k=active[x].S; if (k==n)return; k++; if (k==n){active[x]={0,0};return;} int res=query(x,k); if (res!=par[x]){active[x]={res,k};return;} k++; if (k==n){active[x]={0,0};return;} res=query(x,k); if (res!=par[x]){active[x]={res,k};return;} } void solve(int N,int l){ n=N; vi V; for (int i=1;i<n;i++)V.pb(query(1,i)); vi cur={1}; active[1]={V[0],1}; vi next; for (int x:V){ int vertice=0; for (int y:next)if (active[y].F==x)vertice=y; /// cout<<x<<'\n'; if (vertice){ /// cout<<"MAGIS QVEMOT\n"; answer(vertice,x); par[x]=vertice; add(x); cur=next; next={x}; }else{ for (int y:cur)if (active[y].F==x)vertice=y; /// cout<<"IGIVE SIMAGLE\n"; answer(vertice,x); par[x]=vertice; add(vertice); next.pb(x); add(x); } } } /*signed main(){ int n,l; cin>>n>>l; solve(n,l); }*/
#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...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...