Submission #00035
ソースコード
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 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 | #include <map> #include <set> #include <cmath> #include <queue> #include <stack> #include <cctype> #include <cstdio> #include <string> #include <vector> #include <cstdlib> #include <cstring> #include <sstream> #include <iostream> #include <algorithm> #include <functional> #define INF (2 << 28) #define fr first #define sc second using namespace std; typedef long long ll; typedef pair< int , int > iP; struct edge { int to, cost; }; long long ans[101] = { 0 }; int N, M; int P[350], Q[350], R[350]; vector< vector< edge > > rel; void dfs( int target, int acq) { if (rel[target].size() == 0) ans[target] += acq; for ( int i = 0; i < rel[target].size(); i++) { edge &e = rel[target][i]; dfs(e.to, e.cost * acq); } } int main() { cin >> N >> M; rel.resize(N + 1); for ( int i = 0; i < M; i++) { int p, q, r; cin >> p >> q >> r; rel[r].push_back((edge){p, q}); } dfs(N, 1); for ( int i = 1; i < N; i++) { cout << ans[i] << endl; } } |
ステータス
項目 | データ |
---|---|
問題 | 0002 - PRO製造機 |
ユーザー名 | Jogasaki_Mika_Tanto_P |
投稿日時 | 2015-09-16 17:45:10 |
言語 | C++11 |
状態 | Wrong Answer |
得点 | 20 |
ソースコード長 | 1031 Byte |
最大実行時間 | 24 ms |
最大メモリ使用量 | 576 KB |
セット
セット | 得点 | Cases | |
---|---|---|---|
1 | ALL | 0 / 80 | * |
2 | G☆O☆D☆O☆K☆U | 20 / 20 | 10.txt |
テストケース
ファイル名 | 状態 | 実行時間 | メモリ使用量 | # | |
---|---|---|---|---|---|
1.txt | AC | 22 ms | 476 KB |
1
|
|
2.txt | AC | 18 ms | 420 KB |
1
|
|
3.txt | AC | 20 ms | 528 KB |
1
|
|
4.txt | AC | 24 ms | 504 KB |
1
|
|
5.txt | AC | 23 ms | 352 KB |
1
|
|
6.txt | AC | 17 ms | 456 KB |
1
|
|
7.txt | AC | 23 ms | 428 KB |
1
|
|
8.txt | AC | 18 ms | 528 KB |
1
|
|
9.txt | AC | 19 ms | 500 KB |
1
|
|
10.txt | AC | 24 ms | 452 KB |
1
|
2
|
error1.txt | WA | 16 ms | 472 KB |
1
|
|
system_test1.txt | AC | 20 ms | 444 KB |
1
|
|
system_test2.txt | AC | 20 ms | 416 KB |
1
|
|
system_test3.txt | AC | 22 ms | 516 KB |
1
|
|
system_test4.txt | AC | 17 ms | 484 KB |
1
|
|
system_test5.txt | AC | 19 ms | 576 KB |
1
|