Submission #00027
ソースコード
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 57 58 | #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) { if (rel[target].size() == 0) ans[target]++; for ( int i = 0; i < rel[target].size(); i++) { edge &e = rel[target][i]; for ( int j = 0; j < e.cost; j++) { dfs(e.to); } } } 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); for ( int i = 1; i < N; i++) { cout << ans[i] << endl; } } |
ステータス
項目 | データ |
---|---|
問題 | 0002 - PRO製造機 |
ユーザー名 | Jogasaki_Mika_Tanto_P |
投稿日時 | 2015-09-16 17:34:44 |
言語 | C++11 |
状態 | Time Limit Exceeded |
得点 | 20 |
ソースコード長 | 1048 Byte |
最大実行時間 | 1000 ms |
最大メモリ使用量 | 580 KB |
セット
セット | 得点 | Cases | |
---|---|---|---|
1 | ALL | 0 / 80 | * |
2 | G☆O☆D☆O☆K☆U | 20 / 20 | 10.txt |
テストケース
ファイル名 | 状態 | 実行時間 | メモリ使用量 | # | |
---|---|---|---|---|---|
1.txt | AC | 20 ms | 476 KB |
1
|
|
2.txt | AC | 21 ms | 416 KB |
1
|
|
3.txt | AC | 59 ms | 520 KB |
1
|
|
4.txt | AC | 21 ms | 492 KB |
1
|
|
5.txt | AC | 24 ms | 464 KB |
1
|
|
6.txt | AC | 20 ms | 564 KB |
1
|
|
7.txt | TLE | 1000 ms | 412 KB |
1
|
|
8.txt | AC | 18 ms | 512 KB |
1
|
|
9.txt | AC | 24 ms | 480 KB |
1
|
|
10.txt | AC | 30 ms | 580 KB |
1
|
2
|
error1.txt | TLE | 1000 ms | 328 KB |
1
|
|
system_test1.txt | AC | 16 ms | 436 KB |
1
|
|
system_test2.txt | AC | 24 ms | 544 KB |
1
|
|
system_test3.txt | AC | 20 ms | 512 KB |
1
|
|
system_test4.txt | AC | 24 ms | 480 KB |
1
|
|
system_test5.txt | AC | 13 ms | 448 KB |
1
|