Submission #988606

#TimeUsernameProblemLanguageResultExecution timeMemory
988606kshitij_sodaniIsland Hopping (JOI24_island)C++17
100 / 100
7 ms608 KiB
#include <bits/stdc++.h> using namespace std; #define a first #define b second #define pb push_back typedef long long llo; #define endl '\n' #include "island.h" int it[301]; int co[301]; int ans[301]; int ind[301]; void solve(int n, int L) { vector<int> ss; ind[1]=0; for(int i=1;i<=n-1;i++){ ss.pb(query(1,i)); //it[i]=query(1,i); //ans[i]=-1; ind[ss.back()]=ss.size(); } for(int i=1;i<=n;i++){ ans[i]=-1; } for(auto j:ss){ if(ans[j]!=-1){ continue; } for(int k=1;k<=n-1;k++){ int x=query(j,k); if(ind[x]<ind[j]){ ans[j]=x; break; } ans[x]=j; } } for(int i=2;i<=n;i++){ //cout<<i<<",,"<<ans[i]<<endl; answer(ans[i],i); } /* int variable_example = query(1, 1); for (int i = 2; i <= N; i++) { answer(1, i); }*/ }
#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...