Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <cmath>
- #include <vector>
- #include <queue>
- #include <algorithm>
- #include <string>
- #include <stack>
- #include <set>
- #include <map>
- #define pii pair <int,int>
- using namespace std;
- using ll = long long;
- using ld = long double;
- using db = double;
- void cv(vector <int> &v){
- for (auto x: v) cout<<x<<' ';
- cout<<"\n";
- }
- void cvl(vector <ll> &v){
- for (auto x: v) cout<<x<<' ';
- cout<<"\n";
- }
- void cvv(vector <vector <int> > &v){
- for (auto x: v) cv(x);
- cout<<"\n";
- }
- int n,m;
- vector <int> d;
- struct ed{
- int fr, to;
- ld w;
- };
- vector <vector <ed>> G;
- map
- const int inf = 2e9;
- void readG(){
- cin>>n>>m;
- G.resize(n);
- d.assign(n, inf);
- for (int i=0;i<m;++i){
- int a,b;
- ld w;
- cin>>a>>b>>w;
- a--; b--;
- w /= 1000.0;
- ed any = {a, b, w};
- G[a].push_back(any);
- }
- }
- void shG(){
- cout<<"G\n";
- for (int i=0;i<n;++i){
- cout<<i+1<<"\n";
- for (auto x: G[i]){
- cout<<x.to+1<<' '<<fixed<<x.w<<"\n";
- }
- cout<<"\n";
- }
- }
- void fndWaves(int s){
- d[s] = 0;
- }
- int main()
- {
- ios::sync_with_stdio(0);
- cin.tie(0);
- cout.tie(0);
- cout.precision(5);
- //cin>>n>>m;
- readG();
- //shG();
- }
- /*
- 5 5
- 1 2 2000
- 1 3 1000
- 1 4 1200
- 2 3 1500
- 3 4 1500
- 4
- 1 5
- 2 4
- 3 3
- 1 2
- */
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement