結果
| 問題 | No.1344 Typical Shortest Path Sum |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2025-11-09 23:24:16 |
| 言語 | C++23 (gcc 13.3.0 + boost 1.89.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 641 bytes |
| 記録 | |
| コンパイル時間 | 3,332 ms |
| コンパイル使用メモリ | 281,564 KB |
| 実行使用メモリ | 7,720 KB |
| 最終ジャッジ日時 | 2025-11-09 23:24:23 |
| 合計ジャッジ時間 | 6,191 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 28 WA * 49 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i, s, e) for (int i = (int)(s); i < (int)(e); ++i)
int main() {
cin.tie(nullptr);
ios_base::sync_with_stdio(false);
const ll INF = 1ll << 60;
int N, M;
cin >> N >> M;
vector dp(N, vector<ll>(N, INF));
rep(i, 0, M) {
int s, t;
ll d;
cin >> s >> t >> d;
--s, --t;
dp[s][t] = min(dp[s][t], d);
}
rep(i, 0, N) dp[i][i] = 0;
rep(k, 0, N) {
rep(i, 0, N) rep(j, 0, N) dp[i][j] = min(dp[i][j], dp[i][k] + dp[k][j]);
}
rep(i, 0, N) {
ll ans = 0;
rep(j, 0, N) {
if (dp[i][j] != INF) ans += dp[i][j];
}
cout << ans << '\n';
}
}