Submission #00042
ソースコード
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++){ cout << num[i] << endl; } } void dfs( int R, int E){ if (R == n) return ; 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:52:21 |
言語 | C++11 |
状態 | Wrong Answer |
得点 | 0 |
ソースコード長 | 647 Byte |
最大実行時間 | 26 ms |
最大メモリ使用量 | 540 KB |
セット
セット | 得点 | Cases | |
---|---|---|---|
1 | ALL | 0 / 80 | * |
2 | G☆O☆D☆O☆K☆U | 0 / 20 | 10.txt |
テストケース
ファイル名 | 状態 | 実行時間 | メモリ使用量 | # | |
---|---|---|---|---|---|
1.txt | WA | 18 ms | 472 KB |
1
|
|
2.txt | WA | 23 ms | 432 KB |
1
|
|
3.txt | WA | 19 ms | 540 KB |
1
|
|
4.txt | WA | 20 ms | 516 KB |
1
|
|
5.txt | WA | 19 ms | 360 KB |
1
|
|
6.txt | WA | 21 ms | 464 KB |
1
|
|
7.txt | WA | 26 ms | 444 KB |
1
|
|
8.txt | WA | 15 ms | 424 KB |
1
|
|
9.txt | WA | 20 ms | 532 KB |
1
|
|
10.txt | WA | 14 ms | 456 KB |
1
|
2
|
error1.txt | WA | 21 ms | 504 KB |
1
|
|
system_test1.txt | WA | 26 ms | 360 KB |
1
|
|
system_test2.txt | WA | 20 ms | 344 KB |
1
|
|
system_test3.txt | WA | 18 ms | 452 KB |
1
|
|
system_test4.txt | WA | 20 ms | 424 KB |
1
|
|
system_test5.txt | WA | 19 ms | 396 KB |
1
|