Submission #1038981

#TimeUsernameProblemLanguageResultExecution timeMemory
1038981UnforgettableplIsland Hopping (JOI24_island)C++17
100 / 100
7 ms684 KiB
#include "island.h" #include <bits/stdc++.h> using namespace std; void solve(int N,int L){ vector<vector<int>> adj(N+1); function<bool(int,int,int)> reachable = [&](int x,int p,int tar){ if(x==tar)return true; for(int&i:adj[x])if(i!=p)if(reachable(i,x,tar))return true; return false; }; for(int i=1;i<=N;i++){ for(int j=1;j<N;j++){ auto t = query(i,j); if(t>=i)break; if(reachable(i,-1,t))break; adj[i].emplace_back(t); adj[t].emplace_back(i); answer(i,t); } } }
#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...