結果

問題 No.1344 Typical Shortest Path Sum
ユーザー sushitorunasushitoruna
提出日時 2021-01-16 13:54:36
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 1,791 bytes
コンパイル時間 1,428 ms
コンパイル使用メモリ 171,876 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-05-05 15:58:34
合計ジャッジ時間 3,239 ms
ジャッジサーバーID
(参考情報)
judge4 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
5,248 KB
testcase_01 AC 1 ms
5,376 KB
testcase_02 AC 1 ms
5,376 KB
testcase_03 WA -
testcase_04 WA -
testcase_05 AC 1 ms
5,376 KB
testcase_06 WA -
testcase_07 WA -
testcase_08 AC 2 ms
5,376 KB
testcase_09 WA -
testcase_10 AC 1 ms
5,376 KB
testcase_11 AC 2 ms
5,376 KB
testcase_12 AC 2 ms
5,376 KB
testcase_13 AC 1 ms
5,376 KB
testcase_14 WA -
testcase_15 AC 1 ms
5,376 KB
testcase_16 WA -
testcase_17 WA -
testcase_18 WA -
testcase_19 WA -
testcase_20 AC 1 ms
5,376 KB
testcase_21 WA -
testcase_22 AC 1 ms
5,376 KB
testcase_23 WA -
testcase_24 WA -
testcase_25 AC 2 ms
5,376 KB
testcase_26 WA -
testcase_27 AC 1 ms
5,376 KB
testcase_28 WA -
testcase_29 AC 1 ms
5,376 KB
testcase_30 WA -
testcase_31 WA -
testcase_32 AC 1 ms
5,376 KB
testcase_33 WA -
testcase_34 WA -
testcase_35 AC 1 ms
5,376 KB
testcase_36 AC 1 ms
5,376 KB
testcase_37 WA -
testcase_38 AC 1 ms
5,376 KB
testcase_39 WA -
testcase_40 WA -
testcase_41 WA -
testcase_42 WA -
testcase_43 WA -
testcase_44 WA -
testcase_45 WA -
testcase_46 WA -
testcase_47 WA -
testcase_48 WA -
testcase_49 WA -
testcase_50 WA -
testcase_51 WA -
testcase_52 WA -
testcase_53 WA -
testcase_54 WA -
testcase_55 WA -
testcase_56 WA -
testcase_57 WA -
testcase_58 WA -
testcase_59 WA -
testcase_60 AC 2 ms
5,376 KB
testcase_61 AC 2 ms
5,376 KB
testcase_62 AC 3 ms
5,376 KB
testcase_63 AC 2 ms
5,376 KB
testcase_64 AC 2 ms
5,376 KB
testcase_65 AC 3 ms
5,376 KB
testcase_66 AC 3 ms
5,376 KB
testcase_67 AC 3 ms
5,376 KB
testcase_68 AC 2 ms
5,376 KB
testcase_69 AC 2 ms
5,376 KB
testcase_70 WA -
testcase_71 WA -
testcase_72 AC 1 ms
5,376 KB
testcase_73 AC 1 ms
5,376 KB
testcase_74 WA -
testcase_75 WA -
testcase_76 WA -
testcase_77 WA -
testcase_78 WA -
testcase_79 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
using vi = vector <int>;using vl = vector <long long>;
using vs = vector <string>;using vc = vector <char>;
using ll= long long;using vvl = vector<vector<ll> >;
using vvc = vector<vector<char> >;using vd = vector <double>;
using vpl = vector <pair<ll,ll> >;using vb = vector<bool>;
#define rep(i,r) for(ll i=0;i<(r);i++)
#define Rep(i,l,r) for(ll i=(l);i<(r);i++)
#define print(n) cout<<n<<endl
#define vin(a) rep(i,a.size())cin>>a[i]
#define sortp(d) sort(d.begin(),d.end()) //1234
#define sortm(d) sort(d.rbegin(),d.rend()) //4321
#define all(n) n.begin(),n.end()
 //各位の和 
int wa(ll x){ll sum=0;while(x!=0){sum+=x%10;x/=10;}return sum;}
/*-----------順列生成-----------------
do {
} while (next_permutation(配列変数.begin(), 配列変数.end()));*/
//最大公約数 ユークリッドの互除法
ll gcd(ll a, ll b) {if (b==0) return a;else return gcd(b, a%b);}
//最小公倍数 a*b/gcd
ll lcm(ll a,ll b){return a/gcd(a,b)*b;}
//'A'65,'a'97
/*小数点精度指定
cout<<fixed<<setprecision(9)<<;
*/
//priority_queue 優先度付きキュー
ll modpow(ll a,ll n,ll mod) {ll res=1;while(n>0)
{if(n&1)res=res*a%mod;a=a*a%mod;n >>= 1;}return res;}
ll modinv(ll a,ll mod){return modpow(a, mod - 2, mod);}

ll p=0,q=0,r=0;
int dx[8]={1,0,-1,0,1,-1,-1,1};int dy[8]={0,1,0,-1,1,1,-1,-1};
#define inf 1000000000000000000 //10^12:∞
#define mod 1000000007 //10^9+7:合同式の法
const long double pi = acos(-1);

int main()
{
  ll n,m;cin>>n>>m;
  vvl v(n,vl(n,inf));
  rep(i,n)v[i][i]=0;
  rep(i,m)
  {
    ll s,t,d;cin>>s>>t>>d;
    s--;t--;
    v[s][t]=min(d,v[s][t]);
  }
  rep(k,n)rep(i,n)rep(j,n)
  v[i][j]=min(v[i][j],v[i][k]+v[k][j]);
  rep(i,n)
  {
    p=0;
    rep(j,n)if(v[i][j]<inf)p+=v[i][j];
    print(p);
  }
}
0