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