CSES-Solutions
CSES-Solutions copied to clipboard
Create Longest flight Route
#include<bits/stdc++.h> using namespace std;
/* #include<ext/pb_ds/assoc_container.hpp> #include<ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds; typedef tree<pair<int,int>, null_type, less<pair<int,int>>, rb_tree_tag, tree_order_statistics_node_update> pbds; *A.find_by_order(ith) -> gives kth element A.order_of_key(x) -> no. of elements lesser than x */
#define fastio() ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#define fix(n,f) std::fixed<<std::setprecision(f)<<n #define ll long long #define all(v) v.begin(),v.end() #define nl "\n" #define sum(a,b,m) ((a%m)+(b%m))%m #define pro(a,b,m) ((a%m)*(b%m))%m #define diff(a,b,m) ((a%m)-(b%m)+m)%m
/============================ ░██████╗░██████╗░ ========================/ /============================ ██╔════╝░██╔══██╗ =======================/ /============================ ██║░░██╗░██║░░██║ =======================/ /============================ ██║░░╚██╗██║░░██║ =======================/ /============================ ╚██████╔╝██████╔╝ =======================/ /============================ ░╚═════╝░╚═════╝░ =======================/
/* Before Solving the Problem:
Read each and every word carefully
- Dry run testcases , with pen -paper
- Don't forget the simplest tests
- Stay calm & keep code on */
/======================== =========== I Bow to Lord Shiva =================================/ #define mod 1000000007
void solve(){
ll n,m;
cin>>n>>m;
vector<vector<pair<ll,ll>>> g(n+1);
while(m--){
ll u,v,w;cin>>u>>v>>w;
g[u].push_back({v,w});
}
vector
int main(){ fastio(); //freopen("input.txt", "r" ,stdin); //freopen("output.txt", "w" ,stdout); int t=1; //cin>>t; for(int t1=1;t1<=t;t1++){ solve(); } }