Submission #00038


ソースコード

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
#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(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:48:12
言語 C++11
状態 Wrong Answer
得点 20
ソースコード長 625 Byte
最大実行時間 28 ms
最大メモリ使用量 708 KB

セット

セット 得点 Cases
1 ALL 0 / 80 *
2 G☆O☆D☆O☆K☆U 20 / 20 10.txt

テストケース

ファイル名 状態 実行時間 メモリ使用量 #
1.txt AC 27 ms 476 KB
1
2.txt AC 17 ms 676 KB
1
3.txt AC 17 ms 524 KB
1
4.txt AC 22 ms 628 KB
1
5.txt AC 19 ms 604 KB
1
6.txt AC 23 ms 580 KB
1
7.txt AC 27 ms 424 KB
1
8.txt AC 20 ms 528 KB
1
9.txt AC 17 ms 504 KB
1
10.txt AC 19 ms 708 KB
1
2
error1.txt WA 27 ms 476 KB
1
system_test1.txt AC 16 ms 452 KB
1
system_test2.txt AC 28 ms 556 KB
1
system_test3.txt AC 20 ms 524 KB
1
system_test4.txt AC 20 ms 616 KB
1
system_test5.txt AC 16 ms 584 KB
1