結果
| 問題 |
No.1344 Typical Shortest Path Sum
|
| コンテスト | |
| ユーザー |
a01sa01to
|
| 提出日時 | 2025-04-25 01:01:43 |
| 言語 | C++23 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 796 bytes |
| コンパイル時間 | 3,267 ms |
| コンパイル使用メモリ | 278,608 KB |
| 実行使用メモリ | 7,848 KB |
| 最終ジャッジ日時 | 2025-04-25 01:01:49 |
| 合計ジャッジ時間 | 5,875 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 28 WA * 49 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
#ifdef LOCAL
#include "settings/debug.cpp"
#else
#define Debug(...) void(0)
#endif
#define rep(i, n) for (int i = 0; i < (n); ++i)
using ll = long long;
using ull = unsigned long long;
int main() {
cin.tie(nullptr)->sync_with_stdio(false);
int n, m;
cin >> n >> m;
constexpr ll INF = 1e18;
vector dist(n, vector<ll>(n, INF));
rep(_, m) {
int a, b;
ll c;
cin >> a >> b >> c;
--a, --b;
dist[a][b] = min(dist[a][b], c);
}
rep(i, n) dist[i][i] = 0;
rep(k, n) rep(i, n) rep(j, n) {
dist[i][j] = min(dist[i][j], dist[i][k] + dist[k][j]);
}
rep(i, n) rep(j, n) if (dist[i][j] == INF) dist[i][j] = 0;
rep(i, n) {
ll ans = 0;
rep(j, n) ans += dist[i][j];
cout << ans << '\n';
}
return 0;
}
a01sa01to