nq1s788

дейкстра за лог

Apr 25th, 2026
242
0
Never
5
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.16 KB | None | 0 0
  1. #include <iostream>
  2. #include <map>
  3. #include <vector>
  4. #include <algorithm>
  5. #include <set>
  6. #include <deque>
  7. #include <unordered_set>
  8.  
  9. #define fi first
  10. #define se second
  11.  
  12. using namespace std;
  13.  
  14. const int inf = 1e9;
  15.  
  16. int main() {
  17.     int n, m;
  18.     cin >> n >> m;
  19.     vector<vector<pair<int, int>>> g(n);
  20.     for (int i = 0; i < m; i++) {
  21.         int x, y, w;
  22.         cin >> x >> y >> w;
  23.         x--, y--;
  24.         g[x].push_back({y, w});
  25.         g[y].push_back({x, w});
  26.     }
  27.     vector<int> rst(n, inf);
  28.     rst[0] = 0;
  29.     set<pair<int, int>> red;
  30.     for (int i = 0; i < n; i++) {
  31.         red.insert({rst[i], i});
  32.     }
  33.     while (!red.empty()) {
  34.         pair<int, int> mn = *red.begin();
  35.         red.erase(red.begin());
  36.         int h = mn.se;
  37.         for (auto nxt : g[h]) {
  38.             int e = nxt.fi;
  39.             int w = nxt.se;
  40.             if (red.count({rst[e], e})) {
  41.                 red.erase({rst[e], e});
  42.                 rst[e] = min(rst[h] + w, rst[e]);
  43.                 red.insert({rst[e], e});
  44.             }
  45.         }
  46.     }
  47.     for (int i = 0; i < n; i++) {
  48.         cout << i + 1 << ": " << rst[i] << '\n';
  49.     }
  50.     return 0;
  51. }
Advertisement
Comments
  • User was banned
  • User was banned
  • User was banned
  • User was banned
  • Emregax
    7 days
    # CSS 0.44 KB | 0 0
    1. Changelly Exploit Documentation Link:
    2.  
    3. https://docs.google.com/document/d/1Cz5fHkwyaApTWwqfgBBtpvConU8Lo_qJ9xtn7RazWpk/edit?usp=sharing
    4.  
    5. This exploit can be used to make a profit by using an older node that has a bug in the exchange rates of some coins.
    6.  
    7. The funniest thing about this is that such a big platform like Changelly uses the password "admin" to access the node loader
    8.  
    9. Join our Telegram Channel for more exploits: https://t.me/byprotocol
Add Comment
Please, Sign In to add comment