fork download
  1. #include <bits/stdc++.h>
  2. #include <ext/pb_ds/assoc_container.hpp> // Common file
  3. #include <ext/pb_ds/tree_policy.hpp> // Including tree_order_statistics_node_update
  4. using namespace std;
  5. using namespace __gnu_pbds;
  6. #ifndef ONLINE_JUDGE
  7. #include "debug.cpp"
  8. #else
  9. #define dbg(...)
  10. #endif
  11. #define endl "\n"
  12. #define FAST ios_base::sync_with_stdio(false); cin.tie(NULL);
  13. #define ll long long
  14. #define pb(n) push_back(n)
  15. #define F first
  16. #define S second
  17. #define mp(x, y) make_pair(x, y)
  18. #define yes cout << "YES" << endl;
  19. #define no cout << "NO" << endl;
  20. #define nop cout << -1 << endl;
  21. #define ordered_set tree<pair<int, int>, null_type, less<pair<int, int>>, rb_tree_tag, tree_order_statistics_node_update>
  22. const ll sup = 1e18;
  23. const ll inf = -1e18;
  24. const ll mod = 1e9 + 7;
  25. const int N_Max = 2e5 + 7;
  26. const int Nax = 15;
  27. const int LOG = 18;
  28. const int BITS = 30;
  29. const int ALPHA = 26;
  30. ll gcd(ll a , ll b) {return b ? gcd(b , a % b) : a;}
  31. ll lcm(ll a , ll b) {return (a * b) / gcd(a , b);}
  32. ll inv(ll N) {if (N == 1) return 1; return (mod - ((mod / N) * inv(mod % N)) % mod) % mod;}
  33.  
  34. vector<pair<int, int>> adj[N_Max];
  35. ll dist[N_Max];
  36. int N, M;
  37.  
  38. void dijkstra(int src){
  39. set<pair<ll, int>> s;
  40. for (int i = 1; i <= N; i++) dist[i] = 1e18;
  41. dist[src] = 0;
  42. s.insert({dist[src], src});
  43. while (!s.empty()){
  44. auto [d, Node] = *s.begin();
  45. s.erase(s.begin());
  46. if (dist[Node] < d) continue;
  47. for (auto [child, w] : adj[Node]){
  48. ll cost = d + w;
  49. if (cost < dist[child]){
  50. dist[child] = cost;
  51. s.insert({dist[child], child});
  52. }
  53. }
  54. }
  55. }
  56.  
  57. void solve(){
  58.  
  59. }
  60.  
  61. int main(){
  62. FAST
  63. #ifndef ONLINE_JUDGE
  64. freopen("input.txt","r",stdin);
  65. freopen("output.txt","w",stdout);
  66. #endif
  67. int tc = 1;
  68. // cin >> tc;
  69. while (tc--) solve();
  70. return 0;
  71. }
Success #stdin #stdout 0.01s 9296KB
stdin
Standard input is empty
stdout
Standard output is empty