Run Code
|
API
|
Code Wall
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
Dij. Algo
#include <bits/stdc++.h> using namespace std; int main() { int nodes; cin >> nodes; vector<pair<int, int>> graph[nodes]; int edges; cin >> edges; for(int i = 0; i < edges; i++) { int u, v, w; cin >> u >> v >> w; pair<int, int> adjacent; adjacent.first = v - 1; adjacent.second = w; graph[u - 1].push_back(adjacent); } for(int i = 0; i < nodes; i++) { cout << i + 1; for(int j = 0; j < graph[i].size(); j++) { cout << " -> " << graph[i][j].first + 1; } cout << endl; } return 0; }
run
|
edit
|
history
|
help
0
Gauss Jordan Ida
Template HeapSort
maximum_frequent_sum
Procesos E
Stream2
Policy based smart pointer
data locality - fast example
simple calculator
Hello
Geometric Series