Submission #00030
ソースコード
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 36 37 38 39 40 41 | #include <bits/stdc++.h> using namespace std; long long way[101][101]; long long need[101]; long long used[101]; int N, M; void DFS( int n, int num) { int cnt = 0; for ( int i = 0; i < N-1; i++){ if (i == n) continue ; if (way[n][i] > 0){ DFS(i, way[n][i]*num); cnt++; } } if (cnt == 0) need[n] += num; } int main() { cin >> N >> M; for ( int i = 0; i < M; i++){ int P, Q, R; cin >> P >> Q >> R; --P, --R; way[R][P] = Q; used[R]++; } for ( int i = 0; i < N-1; i++){ if (way[N-1][i] > 0) DFS(i, way[N-1][i]); } for ( int i = 0; i < N-1; i++){ cout << need[i] << endl; } } |
ステータス
項目 | データ |
---|---|
問題 | 0002 - PRO製造機 |
ユーザー名 | ukuku09 |
投稿日時 | 2015-09-16 17:38:06 |
言語 | C++11 |
状態 | Wrong Answer |
得点 | 20 |
ソースコード長 | 680 Byte |
最大実行時間 | 25 ms |
最大メモリ使用量 | 592 KB |
セット
セット | 得点 | Cases | |
---|---|---|---|
1 | ALL | 0 / 80 | * |
2 | G☆O☆D☆O☆K☆U | 20 / 20 | 10.txt |
テストケース
ファイル名 | 状態 | 実行時間 | メモリ使用量 | # | |
---|---|---|---|---|---|
1.txt | AC | 18 ms | 472 KB |
1
|
|
2.txt | AC | 18 ms | 548 KB |
1
|
|
3.txt | AC | 20 ms | 520 KB |
1
|
|
4.txt | AC | 23 ms | 492 KB |
1
|
|
5.txt | AC | 23 ms | 468 KB |
1
|
|
6.txt | AC | 16 ms | 564 KB |
1
|
|
7.txt | AC | 14 ms | 536 KB |
1
|
|
8.txt | AC | 20 ms | 500 KB |
1
|
|
9.txt | AC | 25 ms | 588 KB |
1
|
|
10.txt | AC | 24 ms | 452 KB |
1
|
2
|
error1.txt | WA | 21 ms | 556 KB |
1
|
|
system_test1.txt | AC | 17 ms | 528 KB |
1
|
|
system_test2.txt | AC | 16 ms | 504 KB |
1
|
|
system_test3.txt | AC | 23 ms | 592 KB |
1
|
|
system_test4.txt | AC | 16 ms | 524 KB |
1
|
|
system_test5.txt | AC | 23 ms | 576 KB |
1
|