結果
問題 | No.30 たこやき工場 |
ユーザー |
![]() |
提出日時 | 2016-09-24 03:02:06 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
TLE
(最新)
AC
(最初)
|
実行時間 | - |
コード長 | 759 bytes |
コンパイル時間 | 606 ms |
コンパイル使用メモリ | 67,620 KB |
実行使用メモリ | 6,824 KB |
最終ジャッジ日時 | 2024-12-21 05:25:46 |
合計ジャッジ時間 | 6,575 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 16 TLE * 1 |
ソースコード
#include <iostream> #include <cstdio> #include <string> #include <vector> #include <cmath> #include <algorithm> using namespace std; typedef long long ll; #define rep(i,n) for(int i=0;i<(n);i++) #define reps(i,f,n) for(int i=(f);i<(n);i++) const int INF = 1e9; int n, m; // int p[1550], q[1550], r[1550]; vector<pair<int, int> > G[110]; int memo[110]; void dfs(int u, int num){ if(G[u].size() == 0){ memo[u] += num; return; } for(auto v : G[u]){// u -> v.first dfs(v.first, v.second * num); } return; } int main(void){ cin >> n >> m; rep(i, m){ int p, q, r; cin >> p >> q >> r; p--; r--; //r -> p G[r].push_back(make_pair(p, q)); } rep(i, 110) memo[i] = 0; dfs(n - 1, 1); rep(i, n - 1){ printf("%d\n", memo[i]); } return 0; }