Submission #00029
ソースコード
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 | #include<bits/stdc++.h> #define f first #define s second using namespace std; int n, m; typedef pair< int , int > P; vector<P> v[101]; int num[101]; void dfs( int R, int E); int main(){ cin >> n; for ( int i = 0; i <= n; i++) num[i] = 0; cin >> m; for ( int i = 0; i < m; i++){ int p, q, r; cin >> p >> q >> r; v[r].push_back(P(p, q)); } dfs(n, 1); for ( int i = 1; i <= n; i++){ if (num[i] == INT_MAX) num[i] = 0; cout << num[i] << endl; } } void dfs( int R, int E){ if (v[R].size() == 0) num[R] += E; else { for ( int i = 0; i < v[R].size(); i++){ dfs(v[R][i].f, E * v[R][i].s); } } } |
ステータス
項目 | データ |
---|---|
問題 | 0002 - PRO製造機 |
ユーザー名 | ei1409 |
投稿日時 | 2015-09-16 17:37:42 |
言語 | C++11 |
状態 | Wrong Answer |
得点 | 0 |
ソースコード長 | 665 Byte |
最大実行時間 | 28 ms |
最大メモリ使用量 | 536 KB |
セット
セット | 得点 | Cases | |
---|---|---|---|
1 | ALL | 0 / 80 | * |
2 | G☆O☆D☆O☆K☆U | 0 / 20 | 10.txt |
テストケース
ファイル名 | 状態 | 実行時間 | メモリ使用量 | # | |
---|---|---|---|---|---|
1.txt | WA | 18 ms | 476 KB |
1
|
|
2.txt | WA | 19 ms | 428 KB |
1
|
|
3.txt | WA | 19 ms | 536 KB |
1
|
|
4.txt | WA | 14 ms | 516 KB |
1
|
|
5.txt | WA | 23 ms | 372 KB |
1
|
|
6.txt | WA | 21 ms | 484 KB |
1
|
|
7.txt | WA | 23 ms | 464 KB |
1
|
|
8.txt | WA | 24 ms | 444 KB |
1
|
|
9.txt | WA | 19 ms | 420 KB |
1
|
|
10.txt | WA | 16 ms | 456 KB |
1
|
2
|
error1.txt | WA | 18 ms | 524 KB |
1
|
|
system_test1.txt | WA | 16 ms | 372 KB |
1
|
|
system_test2.txt | WA | 19 ms | 352 KB |
1
|
|
system_test3.txt | WA | 28 ms | 452 KB |
1
|
|
system_test4.txt | WA | 15 ms | 432 KB |
1
|
|
system_test5.txt | WA | 23 ms | 536 KB |
1
|