Advertisement
Josif_tepe

Untitled

Mar 10th, 2022
981
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.52 KB | None | 0 0
  1. #include <iostream>
  2. #include <cmath>
  3. #include <vector>
  4. #include <queue>
  5. #include <algorithm>
  6. #include <cstring>
  7. #include <fstream>
  8. using namespace std;
  9. vector<pair<int, int> > graph[105];
  10. int main() {
  11.     int n ,m;
  12.     cin >> n >> m;
  13.     for(int i =0; i < m; i++) {
  14.         int a, b, c;
  15.         cin >> a >> b >> c;
  16.         graph[a].push_back(make_pair(c, b));
  17.         graph[b].push_back(make_pair(c, a));
  18.     }
  19.     for(int i =0  ;i < n; i++) {
  20.         sort(graph[i].begin(), graph[i].end());
  21.     }
  22.     return 0;
  23. }
  24.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement