# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
987187 | 2024-05-22T09:11:27 Z | AdamGS | 장난감 기차 (IOI17_train) | C++17 | 1065 ms | 1880 KB |
#include "train.h" #include<bits/stdc++.h> using namespace std; typedef long long ll; #define rep(a, b) for(int a = 0; a < (b); ++a) #define st first #define nd second #define pb push_back #define all(a) a.begin(), a.end() const int LIM=5e3+7; vector<int>V[LIM], S[LIM]; int deg[LIM]; vector<int>who_wins(vector<int>a, vector<int>r, vector<int>u, vector<int>v) { int n=a.size(), m=u.size(); vector<int>ans(n); rep(i, m) { V[u[i]].pb(v[i]); S[v[i]].pb(u[i]); } rep(i, n) { rep(j, n) { ans[j]=0; if(r[j]) deg[j]=0; else if(!a[j]) deg[j]=V[j].size(); else deg[j]=1; } queue<int>q; rep(j, n) if(deg[j]==0) q.push(j); while(!q.empty()) { int p=q.front(); q.pop(); ans[p]=1; for(auto j : S[p]) { --deg[j]; if(deg[j]==0) q.push(j); } } rep(j, n) if(r[j]) { int sum=0; for(auto l : V[j]) sum+=ans[l]; if(a[j] && sum==0 || !a[j] && sum<V[j].size()) r[j]=0; } } return ans; }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 463 ms | 1368 KB | Output is correct |
2 | Correct | 411 ms | 1280 KB | Output is correct |
3 | Correct | 407 ms | 1284 KB | Output is correct |
4 | Correct | 392 ms | 1276 KB | Output is correct |
5 | Correct | 407 ms | 1528 KB | Output is correct |
6 | Correct | 443 ms | 1120 KB | Output is correct |
7 | Correct | 149 ms | 1276 KB | Output is correct |
8 | Correct | 676 ms | 1272 KB | Output is correct |
9 | Correct | 471 ms | 1256 KB | Output is correct |
10 | Correct | 455 ms | 1360 KB | Output is correct |
11 | Correct | 376 ms | 1112 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 604 KB | Output is correct |
2 | Correct | 1 ms | 604 KB | Output is correct |
3 | Correct | 1 ms | 604 KB | Output is correct |
4 | Correct | 1 ms | 604 KB | Output is correct |
5 | Correct | 1 ms | 680 KB | Output is correct |
6 | Correct | 1 ms | 604 KB | Output is correct |
7 | Correct | 1 ms | 604 KB | Output is correct |
8 | Correct | 1 ms | 604 KB | Output is correct |
9 | Correct | 1 ms | 604 KB | Output is correct |
10 | Correct | 1 ms | 604 KB | Output is correct |
11 | Correct | 1 ms | 604 KB | Output is correct |
12 | Correct | 1 ms | 604 KB | Output is correct |
13 | Correct | 1 ms | 604 KB | Output is correct |
14 | Correct | 1 ms | 532 KB | Output is correct |
15 | Correct | 1 ms | 676 KB | Output is correct |
16 | Correct | 1 ms | 800 KB | Output is correct |
17 | Correct | 1 ms | 604 KB | Output is correct |
18 | Correct | 1 ms | 604 KB | Output is correct |
19 | Correct | 1 ms | 600 KB | Output is correct |
20 | Correct | 1 ms | 604 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 136 ms | 1556 KB | Output is correct |
2 | Correct | 146 ms | 1624 KB | Output is correct |
3 | Correct | 161 ms | 1744 KB | Output is correct |
4 | Correct | 920 ms | 1720 KB | Output is correct |
5 | Correct | 471 ms | 1716 KB | Output is correct |
6 | Correct | 105 ms | 1704 KB | Output is correct |
7 | Correct | 1065 ms | 1704 KB | Output is correct |
8 | Correct | 185 ms | 1628 KB | Output is correct |
9 | Correct | 100 ms | 1628 KB | Output is correct |
10 | Correct | 454 ms | 1672 KB | Output is correct |
11 | Correct | 214 ms | 1628 KB | Output is correct |
12 | Correct | 101 ms | 1372 KB | Output is correct |
13 | Correct | 724 ms | 1872 KB | Output is correct |
14 | Correct | 722 ms | 1628 KB | Output is correct |
15 | Correct | 733 ms | 1724 KB | Output is correct |
16 | Correct | 760 ms | 1716 KB | Output is correct |
17 | Correct | 770 ms | 1712 KB | Output is correct |
18 | Correct | 226 ms | 1372 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 728 ms | 1372 KB | Output is correct |
2 | Correct | 595 ms | 1584 KB | Output is correct |
3 | Correct | 113 ms | 1628 KB | Output is correct |
4 | Correct | 103 ms | 1700 KB | Output is correct |
5 | Correct | 355 ms | 1696 KB | Output is correct |
6 | Correct | 619 ms | 1880 KB | Output is correct |
7 | Correct | 597 ms | 1672 KB | Output is correct |
8 | Correct | 113 ms | 1876 KB | Output is correct |
9 | Correct | 664 ms | 1628 KB | Output is correct |
10 | Correct | 867 ms | 1624 KB | Output is correct |
11 | Correct | 771 ms | 1732 KB | Output is correct |
12 | Correct | 878 ms | 1720 KB | Output is correct |
13 | Correct | 394 ms | 1704 KB | Output is correct |
14 | Correct | 547 ms | 1628 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 511 ms | 1372 KB | Output is correct |
2 | Correct | 856 ms | 1724 KB | Output is correct |
3 | Correct | 777 ms | 1712 KB | Output is correct |
4 | Correct | 949 ms | 1624 KB | Output is correct |
5 | Correct | 1 ms | 600 KB | Output is correct |
6 | Correct | 123 ms | 1112 KB | Output is correct |
7 | Correct | 19 ms | 1380 KB | Output is correct |
8 | Correct | 6 ms | 1368 KB | Output is correct |
9 | Correct | 11 ms | 1368 KB | Output is correct |
10 | Correct | 2 ms | 860 KB | Output is correct |
11 | Correct | 21 ms | 1368 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 463 ms | 1368 KB | Output is correct |
2 | Correct | 411 ms | 1280 KB | Output is correct |
3 | Correct | 407 ms | 1284 KB | Output is correct |
4 | Correct | 392 ms | 1276 KB | Output is correct |
5 | Correct | 407 ms | 1528 KB | Output is correct |
6 | Correct | 443 ms | 1120 KB | Output is correct |
7 | Correct | 149 ms | 1276 KB | Output is correct |
8 | Correct | 676 ms | 1272 KB | Output is correct |
9 | Correct | 471 ms | 1256 KB | Output is correct |
10 | Correct | 455 ms | 1360 KB | Output is correct |
11 | Correct | 376 ms | 1112 KB | Output is correct |
12 | Correct | 1 ms | 604 KB | Output is correct |
13 | Correct | 1 ms | 604 KB | Output is correct |
14 | Correct | 1 ms | 604 KB | Output is correct |
15 | Correct | 1 ms | 604 KB | Output is correct |
16 | Correct | 1 ms | 680 KB | Output is correct |
17 | Correct | 1 ms | 604 KB | Output is correct |
18 | Correct | 1 ms | 604 KB | Output is correct |
19 | Correct | 1 ms | 604 KB | Output is correct |
20 | Correct | 1 ms | 604 KB | Output is correct |
21 | Correct | 1 ms | 604 KB | Output is correct |
22 | Correct | 1 ms | 604 KB | Output is correct |
23 | Correct | 1 ms | 604 KB | Output is correct |
24 | Correct | 1 ms | 604 KB | Output is correct |
25 | Correct | 1 ms | 532 KB | Output is correct |
26 | Correct | 1 ms | 676 KB | Output is correct |
27 | Correct | 1 ms | 800 KB | Output is correct |
28 | Correct | 1 ms | 604 KB | Output is correct |
29 | Correct | 1 ms | 604 KB | Output is correct |
30 | Correct | 1 ms | 600 KB | Output is correct |
31 | Correct | 1 ms | 604 KB | Output is correct |
32 | Correct | 136 ms | 1556 KB | Output is correct |
33 | Correct | 146 ms | 1624 KB | Output is correct |
34 | Correct | 161 ms | 1744 KB | Output is correct |
35 | Correct | 920 ms | 1720 KB | Output is correct |
36 | Correct | 471 ms | 1716 KB | Output is correct |
37 | Correct | 105 ms | 1704 KB | Output is correct |
38 | Correct | 1065 ms | 1704 KB | Output is correct |
39 | Correct | 185 ms | 1628 KB | Output is correct |
40 | Correct | 100 ms | 1628 KB | Output is correct |
41 | Correct | 454 ms | 1672 KB | Output is correct |
42 | Correct | 214 ms | 1628 KB | Output is correct |
43 | Correct | 101 ms | 1372 KB | Output is correct |
44 | Correct | 724 ms | 1872 KB | Output is correct |
45 | Correct | 722 ms | 1628 KB | Output is correct |
46 | Correct | 733 ms | 1724 KB | Output is correct |
47 | Correct | 760 ms | 1716 KB | Output is correct |
48 | Correct | 770 ms | 1712 KB | Output is correct |
49 | Correct | 226 ms | 1372 KB | Output is correct |
50 | Correct | 728 ms | 1372 KB | Output is correct |
51 | Correct | 595 ms | 1584 KB | Output is correct |
52 | Correct | 113 ms | 1628 KB | Output is correct |
53 | Correct | 103 ms | 1700 KB | Output is correct |
54 | Correct | 355 ms | 1696 KB | Output is correct |
55 | Correct | 619 ms | 1880 KB | Output is correct |
56 | Correct | 597 ms | 1672 KB | Output is correct |
57 | Correct | 113 ms | 1876 KB | Output is correct |
58 | Correct | 664 ms | 1628 KB | Output is correct |
59 | Correct | 867 ms | 1624 KB | Output is correct |
60 | Correct | 771 ms | 1732 KB | Output is correct |
61 | Correct | 878 ms | 1720 KB | Output is correct |
62 | Correct | 394 ms | 1704 KB | Output is correct |
63 | Correct | 547 ms | 1628 KB | Output is correct |
64 | Correct | 511 ms | 1372 KB | Output is correct |
65 | Correct | 856 ms | 1724 KB | Output is correct |
66 | Correct | 777 ms | 1712 KB | Output is correct |
67 | Correct | 949 ms | 1624 KB | Output is correct |
68 | Correct | 1 ms | 600 KB | Output is correct |
69 | Correct | 123 ms | 1112 KB | Output is correct |
70 | Correct | 19 ms | 1380 KB | Output is correct |
71 | Correct | 6 ms | 1368 KB | Output is correct |
72 | Correct | 11 ms | 1368 KB | Output is correct |
73 | Correct | 2 ms | 860 KB | Output is correct |
74 | Correct | 21 ms | 1368 KB | Output is correct |
75 | Correct | 136 ms | 1628 KB | Output is correct |
76 | Correct | 173 ms | 1628 KB | Output is correct |
77 | Correct | 188 ms | 1624 KB | Output is correct |
78 | Correct | 187 ms | 1752 KB | Output is correct |
79 | Correct | 184 ms | 1760 KB | Output is correct |
80 | Correct | 1002 ms | 1876 KB | Output is correct |
81 | Correct | 370 ms | 1628 KB | Output is correct |
82 | Correct | 508 ms | 1876 KB | Output is correct |
83 | Correct | 492 ms | 1716 KB | Output is correct |
84 | Correct | 257 ms | 1624 KB | Output is correct |
85 | Correct | 110 ms | 1700 KB | Output is correct |
86 | Correct | 203 ms | 1716 KB | Output is correct |
87 | Correct | 105 ms | 1624 KB | Output is correct |
88 | Correct | 219 ms | 1628 KB | Output is correct |
89 | Correct | 400 ms | 1704 KB | Output is correct |
90 | Correct | 127 ms | 1628 KB | Output is correct |
91 | Correct | 133 ms | 1712 KB | Output is correct |
92 | Correct | 352 ms | 1724 KB | Output is correct |
93 | Correct | 201 ms | 1628 KB | Output is correct |
94 | Correct | 191 ms | 1712 KB | Output is correct |
95 | Correct | 383 ms | 1872 KB | Output is correct |
96 | Correct | 634 ms | 1640 KB | Output is correct |
97 | Correct | 264 ms | 1628 KB | Output is correct |
98 | Correct | 322 ms | 1708 KB | Output is correct |
99 | Correct | 321 ms | 1668 KB | Output is correct |
100 | Correct | 224 ms | 1368 KB | Output is correct |