Write a program below |
#include <iostream>
#include <vector>
using namespace std;
int main() {
int n, m, s, f;
const int V = 4;
vector< vector < pair <int, int>>> adj(V+1);
adj[1].push_back({ 2,5 });
// остальные ребра добавьте сами
|
|
for (size_t i = 1; i <= V; i++)
{
cout << i << ": ";
for (auto x : adj[i])
cout << "-> " << x.first << "("<<x.second<<")";
cout << "\n";
}
return 0;
}
|