結果
| 問題 | No.30 たこやき工場 |
| コンテスト | |
| ユーザー |
tottoripaper
|
| 提出日時 | 2014-11-18 00:24:08 |
| 言語 | C++11 (gcc 15.2.0 + boost 1.89.0) |
| 結果 |
TLE
|
| 実行時間 | - |
| コード長 | 640 bytes |
| 記録 | |
| コンパイル時間 | 595 ms |
| コンパイル使用メモリ | 77,440 KB |
| 実行使用メモリ | 13,056 KB |
| 最終ジャッジ日時 | 2026-06-06 04:59:30 |
| 合計ジャッジ時間 | 9,287 ms |
|
ジャッジサーバーID (参考情報) |
judge2_0 / judge1_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 10 TLE * 1 -- * 6 |
ソースコード
#include <iostream>
#include <cstdio>
#include <vector>
typedef long long ll;
struct Edge{
int to, cost;
};
std::vector<Edge> G[101];
ll table[101];
void dfs(int u, ll k){
for(auto e : G[u]){
if(G[e.to].empty()){
table[e.to] += k * e.cost;
}
dfs(e.to, k*e.cost);
}
}
int main(){
int N, M;
scanf("%d %d", &N, &M);
for(int i=0;i<M;i++){
int p, q, r;
scanf("%d %d %d", &p, &q, &r);
G[r].push_back({p, q});
}
dfs(N, 1ll);
for(int i=1;i<N;i++){
printf("%lld\n", table[i]);
}
}
tottoripaper