Flight Routes Check 判断是不是一个强连通图,如果不是,就找出不能到达的单程 tarjan 模板 判断不能到达的,直接从11开始走一次搜索,如果与11不同强连通块上的点,且11能够到达那个点,显然答案就是从那个点到11 记得考虑整个图不连通的情况 #include<iostream>#include<cstdio>#include<algo
// Problem: Flight Routes Check // URL: https://vjudge.net/problem/CSES-1682 // // Powered by CP Editor (https://cpeditor.org) #include<bits/stdc++.h> using namespace std; const int maxn=1e5+5; vector<int> adj[maxn]; vector<int> jda[maxn]; bool vis...
Hello. I am solving the cses problemFlight Routesbut I am getting TLE in some of the test cases. My approach: 1. use dijkstra and keep a distance array of size N*K Dijkstra's code: staticvoiddj(ArrayList<ArrayList<pair>>graph,intstart,intk,long[][]dis){ArrayDeque<pair>dq=newArrayDequ...