結果
| 問題 |
No.30 たこやき工場
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2017-02-27 19:58:19 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
TLE
(最新)
AC
(最初)
|
| 実行時間 | - |
| コード長 | 567 bytes |
| コンパイル時間 | 1,802 ms |
| コンパイル使用メモリ | 172,444 KB |
| 実行使用メモリ | 6,824 KB |
| 最終ジャッジ日時 | 2024-12-21 05:26:19 |
| 合計ジャッジ時間 | 7,258 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 16 TLE * 1 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll, int> P;
int ans[100];
vector<P> g[100];
void dfs(int cur, ll cost) {
if (g[cur].empty()) {
ans[cur] += cost;
return;
}
for (P p : g[cur]) {
dfs(p.second, cost * p.first);
}
}
int main() {
cin.tie(0);
ios::sync_with_stdio(false);
int n, m;
cin >> n >> m;
for (int i = 0; i < m; i++) {
int p, r;
ll q;
cin >> p >> q >> r;
p--;
r--;
g[r].emplace_back(q, p);
}
dfs(n - 1, 1);
for (int i = 0; i < n - 1; i++) {
cout << ans[i] << endl;
}
return 0;
}