結果
| 問題 |
No.30 たこやき工場
|
| コンテスト | |
| ユーザー |
ren0824xemnas
|
| 提出日時 | 2015-09-14 21:07:21 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
TLE
|
| 実行時間 | - |
| コード長 | 608 bytes |
| コンパイル時間 | 677 ms |
| コンパイル使用メモリ | 63,416 KB |
| 実行使用メモリ | 8,576 KB |
| 最終ジャッジ日時 | 2024-07-19 06:27:30 |
| 合計ジャッジ時間 | 7,093 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 10 TLE * 1 -- * 6 |
ソースコード
#include<iostream>
#include<vector>
#include<algorithm>
using namespace std;
typedef pair<int,int> P;
typedef long long int ll;
void bfs(int now,ll num);
int n,m;
vector<P> data[101];
ll cou[101] = {0};
int main(){
cin >> n >> m;
for(int i=0;i<m;i++){
int a,b,c;
cin >> a >> b >> c;
data[c].push_back(P(a,b));
}
bfs(n,1);
for(int i=1;i<n;i++){
cout << cou[i] << endl;
}
}
void bfs(int now,ll num){
int len = data[now].size();
if(len == 0){
cou[now] += num;
return;
}
for(int i=0;i<len;i++){
P p = data[now][i];
int next = p.first;
ll nnum = p.second;
bfs(next,num*nnum);
}
}
ren0824xemnas