#include <bits/stdc++.h>
using namespace std;
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define int long long
typedef pair<int, int> ii;
const int N = 1e5 + 5;
const int inf = 1e15;
int c[N], par[N], f[N], ck[N], res[2], val[N], ans, dp[N], n, lmao[N];
vector<int> graph[N], cycle, vec;
bool vis[N];
void dfs(int u) {
if(lmao[u]) return ;
vec.pb(u);
if(vis[u] == 1) {
int p = par[u];
cycle.pb(u);
while(p != u) {
cycle.pb(p);
p = par[p];
}
reverse(cycle.begin(), cycle.end());
return ;
}
vis[u]++;
for(int i = 0; i < graph[u].size(); i++) {
int v = graph[u][i];
par[v] = u;
dfs(v);
}
}
void bfs(int u) {
vis[u] = 1;
int mx = 0;
for(int i = 0; i < graph[u].size(); i++) {
int v = graph[u][i];
if(ck[v]) continue;
bfs(v);
dp[u] += dp[v];
dp[u] += c[v];
mx = max(mx, c[v]);
}
dp[u] -= mx;
val[u] = mx;
}
signed main() {
cin.tie(0), ios::sync_with_stdio(0);
//freopen("test.inp", "r", stdin);
//freopen("test.out", "w", stdout);
cin >> n;
for(int i = 1; i <= n; i++) {
int p;
cin >> p >> c[i];
graph[p].pb(i);
}
for(int i = 1; i <= n; i++) {
if(!vis[i]) {
vec.clear();
cycle.clear();
dfs(i);
for(int j = 0; j < vec.size(); j++)
lmao[vec[j]] = 1;
if(cycle.size() == 0) continue;
if(cycle.size() == n) {
cout << "0\n";
exit(0);
}
for(int j = 0; j < cycle.size(); j++)
ck[cycle[j]] = 1;
memset(f, 0, sizeof(f));
f[1] = inf;
int m = cycle.size();
for(int j = 0; j < m; j++) {
int u = cycle[j], nxt = cycle[(j + 1) % m];
bfs(u);
f[1] = min(f[1] + dp[cycle[j]] + val[cycle[j]], f[0] + dp[cycle[j]] + c[nxt]);
f[0] = f[0] + dp[cycle[j]] + val[cycle[j]];
f[0] = min(f[1], f[0]);
}
ans = ans + f[1];
}
}
cout << ans;
}
Compilation message
telegraph.cpp: In function 'void dfs(long long int)':
telegraph.cpp:34:11: warning: use of an operand of type 'bool' in 'operator++' is deprecated [-Wdeprecated]
vis[u]++;
^~
telegraph.cpp:35:22: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
for(int i = 0; i < graph[u].size(); i++) {
~~^~~~~~~~~~~~~~~~~
telegraph.cpp: In function 'void bfs(long long int)':
telegraph.cpp:45:22: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
for(int i = 0; i < graph[u].size(); i++) {
~~^~~~~~~~~~~~~~~~~
telegraph.cpp: In function 'int main()':
telegraph.cpp:72:30: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
for(int j = 0; j < vec.size(); j++)
~~^~~~~~~~~~~~
telegraph.cpp:75:29: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
if(cycle.size() == n) {
~~~~~~~~~~~~~^~~~
telegraph.cpp:79:30: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
for(int j = 0; j < cycle.size(); j++)
~~^~~~~~~~~~~~~~
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
4 ms |
3448 KB |
Output is correct |
2 |
Correct |
4 ms |
3448 KB |
Output is correct |
3 |
Correct |
4 ms |
3576 KB |
Output is correct |
4 |
Correct |
4 ms |
3576 KB |
Output is correct |
5 |
Correct |
4 ms |
3576 KB |
Output is correct |
6 |
Correct |
4 ms |
2680 KB |
Output is correct |
7 |
Correct |
4 ms |
2680 KB |
Output is correct |
8 |
Correct |
3 ms |
2680 KB |
Output is correct |
9 |
Correct |
4 ms |
2680 KB |
Output is correct |
10 |
Correct |
4 ms |
2680 KB |
Output is correct |
11 |
Correct |
4 ms |
3576 KB |
Output is correct |
12 |
Correct |
5 ms |
3620 KB |
Output is correct |
13 |
Correct |
4 ms |
3576 KB |
Output is correct |
14 |
Correct |
4 ms |
3576 KB |
Output is correct |
15 |
Correct |
4 ms |
3576 KB |
Output is correct |
16 |
Correct |
4 ms |
3576 KB |
Output is correct |
17 |
Correct |
4 ms |
3448 KB |
Output is correct |
18 |
Correct |
5 ms |
3576 KB |
Output is correct |
19 |
Correct |
4 ms |
3448 KB |
Output is correct |
20 |
Correct |
5 ms |
3576 KB |
Output is correct |
21 |
Correct |
4 ms |
3448 KB |
Output is correct |
22 |
Correct |
4 ms |
3576 KB |
Output is correct |
23 |
Correct |
4 ms |
3448 KB |
Output is correct |
24 |
Correct |
4 ms |
3576 KB |
Output is correct |
25 |
Correct |
4 ms |
3448 KB |
Output is correct |
26 |
Correct |
4 ms |
3448 KB |
Output is correct |
27 |
Correct |
4 ms |
3448 KB |
Output is correct |
28 |
Correct |
4 ms |
3448 KB |
Output is correct |
29 |
Correct |
4 ms |
3448 KB |
Output is correct |
30 |
Correct |
4 ms |
3448 KB |
Output is correct |
31 |
Correct |
4 ms |
3576 KB |
Output is correct |
32 |
Correct |
4 ms |
3576 KB |
Output is correct |
33 |
Correct |
4 ms |
3448 KB |
Output is correct |
34 |
Correct |
4 ms |
3576 KB |
Output is correct |
35 |
Correct |
5 ms |
3448 KB |
Output is correct |
36 |
Correct |
4 ms |
3448 KB |
Output is correct |
37 |
Correct |
4 ms |
3452 KB |
Output is correct |
38 |
Correct |
4 ms |
3576 KB |
Output is correct |
39 |
Correct |
4 ms |
3448 KB |
Output is correct |
40 |
Correct |
4 ms |
3576 KB |
Output is correct |
41 |
Correct |
4 ms |
3576 KB |
Output is correct |
42 |
Correct |
4 ms |
3576 KB |
Output is correct |
43 |
Correct |
4 ms |
3448 KB |
Output is correct |
44 |
Correct |
4 ms |
3448 KB |
Output is correct |
45 |
Correct |
4 ms |
3448 KB |
Output is correct |
46 |
Correct |
3 ms |
2684 KB |
Output is correct |
47 |
Correct |
3 ms |
2680 KB |
Output is correct |
48 |
Correct |
3 ms |
2680 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
4 ms |
3448 KB |
Output is correct |
2 |
Correct |
4 ms |
3448 KB |
Output is correct |
3 |
Correct |
4 ms |
3576 KB |
Output is correct |
4 |
Correct |
4 ms |
3576 KB |
Output is correct |
5 |
Correct |
4 ms |
3576 KB |
Output is correct |
6 |
Correct |
4 ms |
2680 KB |
Output is correct |
7 |
Correct |
4 ms |
2680 KB |
Output is correct |
8 |
Correct |
3 ms |
2680 KB |
Output is correct |
9 |
Correct |
4 ms |
2680 KB |
Output is correct |
10 |
Correct |
4 ms |
2680 KB |
Output is correct |
11 |
Correct |
4 ms |
3576 KB |
Output is correct |
12 |
Correct |
5 ms |
3620 KB |
Output is correct |
13 |
Correct |
4 ms |
3576 KB |
Output is correct |
14 |
Correct |
4 ms |
3576 KB |
Output is correct |
15 |
Correct |
4 ms |
3576 KB |
Output is correct |
16 |
Correct |
4 ms |
3576 KB |
Output is correct |
17 |
Correct |
4 ms |
3448 KB |
Output is correct |
18 |
Correct |
5 ms |
3576 KB |
Output is correct |
19 |
Correct |
4 ms |
3448 KB |
Output is correct |
20 |
Correct |
5 ms |
3576 KB |
Output is correct |
21 |
Correct |
4 ms |
3448 KB |
Output is correct |
22 |
Correct |
4 ms |
3576 KB |
Output is correct |
23 |
Correct |
4 ms |
3448 KB |
Output is correct |
24 |
Correct |
4 ms |
3576 KB |
Output is correct |
25 |
Correct |
4 ms |
3448 KB |
Output is correct |
26 |
Correct |
4 ms |
3448 KB |
Output is correct |
27 |
Correct |
4 ms |
3448 KB |
Output is correct |
28 |
Correct |
4 ms |
3448 KB |
Output is correct |
29 |
Correct |
4 ms |
3448 KB |
Output is correct |
30 |
Correct |
4 ms |
3448 KB |
Output is correct |
31 |
Correct |
4 ms |
3576 KB |
Output is correct |
32 |
Correct |
4 ms |
3576 KB |
Output is correct |
33 |
Correct |
4 ms |
3448 KB |
Output is correct |
34 |
Correct |
4 ms |
3576 KB |
Output is correct |
35 |
Correct |
5 ms |
3448 KB |
Output is correct |
36 |
Correct |
4 ms |
3448 KB |
Output is correct |
37 |
Correct |
4 ms |
3452 KB |
Output is correct |
38 |
Correct |
4 ms |
3576 KB |
Output is correct |
39 |
Correct |
4 ms |
3448 KB |
Output is correct |
40 |
Correct |
4 ms |
3576 KB |
Output is correct |
41 |
Correct |
4 ms |
3576 KB |
Output is correct |
42 |
Correct |
4 ms |
3576 KB |
Output is correct |
43 |
Correct |
4 ms |
3448 KB |
Output is correct |
44 |
Correct |
4 ms |
3448 KB |
Output is correct |
45 |
Correct |
4 ms |
3448 KB |
Output is correct |
46 |
Correct |
3 ms |
2684 KB |
Output is correct |
47 |
Correct |
3 ms |
2680 KB |
Output is correct |
48 |
Correct |
3 ms |
2680 KB |
Output is correct |
49 |
Correct |
4 ms |
3448 KB |
Output is correct |
50 |
Correct |
4 ms |
3448 KB |
Output is correct |
51 |
Correct |
5 ms |
3540 KB |
Output is correct |
52 |
Correct |
4 ms |
3448 KB |
Output is correct |
53 |
Correct |
4 ms |
3576 KB |
Output is correct |
54 |
Correct |
3 ms |
2680 KB |
Output is correct |
55 |
Correct |
3 ms |
2680 KB |
Output is correct |
56 |
Correct |
3 ms |
2680 KB |
Output is correct |
57 |
Correct |
3 ms |
2680 KB |
Output is correct |
58 |
Correct |
3 ms |
2680 KB |
Output is correct |
59 |
Correct |
4 ms |
3496 KB |
Output is correct |
60 |
Correct |
4 ms |
3448 KB |
Output is correct |
61 |
Correct |
4 ms |
3448 KB |
Output is correct |
62 |
Correct |
4 ms |
3468 KB |
Output is correct |
63 |
Correct |
4 ms |
3448 KB |
Output is correct |
64 |
Correct |
4 ms |
3576 KB |
Output is correct |
65 |
Correct |
3 ms |
3576 KB |
Output is correct |
66 |
Correct |
4 ms |
3448 KB |
Output is correct |
67 |
Correct |
4 ms |
3448 KB |
Output is correct |
68 |
Correct |
4 ms |
3576 KB |
Output is correct |
69 |
Correct |
4 ms |
3576 KB |
Output is correct |
70 |
Correct |
4 ms |
3500 KB |
Output is correct |
71 |
Correct |
4 ms |
3448 KB |
Output is correct |
72 |
Correct |
4 ms |
3480 KB |
Output is correct |
73 |
Correct |
4 ms |
3448 KB |
Output is correct |
74 |
Correct |
4 ms |
3576 KB |
Output is correct |
75 |
Correct |
4 ms |
3448 KB |
Output is correct |
76 |
Correct |
4 ms |
3448 KB |
Output is correct |
77 |
Correct |
4 ms |
3448 KB |
Output is correct |
78 |
Correct |
4 ms |
3576 KB |
Output is correct |
79 |
Correct |
4 ms |
3580 KB |
Output is correct |
80 |
Correct |
4 ms |
3576 KB |
Output is correct |
81 |
Correct |
4 ms |
3448 KB |
Output is correct |
82 |
Correct |
4 ms |
3448 KB |
Output is correct |
83 |
Correct |
4 ms |
3448 KB |
Output is correct |
84 |
Correct |
4 ms |
3576 KB |
Output is correct |
85 |
Correct |
4 ms |
3576 KB |
Output is correct |
86 |
Correct |
4 ms |
3576 KB |
Output is correct |
87 |
Correct |
4 ms |
3576 KB |
Output is correct |
88 |
Correct |
5 ms |
3576 KB |
Output is correct |
89 |
Correct |
4 ms |
3576 KB |
Output is correct |
90 |
Correct |
4 ms |
3448 KB |
Output is correct |
91 |
Correct |
4 ms |
3576 KB |
Output is correct |
92 |
Correct |
4 ms |
3448 KB |
Output is correct |
93 |
Correct |
4 ms |
3448 KB |
Output is correct |
94 |
Correct |
3 ms |
2680 KB |
Output is correct |
95 |
Correct |
3 ms |
2680 KB |
Output is correct |
96 |
Correct |
3 ms |
2680 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
4 ms |
3448 KB |
Output is correct |
2 |
Correct |
4 ms |
3448 KB |
Output is correct |
3 |
Correct |
4 ms |
3576 KB |
Output is correct |
4 |
Correct |
4 ms |
3576 KB |
Output is correct |
5 |
Correct |
4 ms |
3576 KB |
Output is correct |
6 |
Correct |
4 ms |
2680 KB |
Output is correct |
7 |
Correct |
4 ms |
2680 KB |
Output is correct |
8 |
Correct |
3 ms |
2680 KB |
Output is correct |
9 |
Correct |
4 ms |
2680 KB |
Output is correct |
10 |
Correct |
4 ms |
2680 KB |
Output is correct |
11 |
Correct |
4 ms |
3576 KB |
Output is correct |
12 |
Correct |
5 ms |
3620 KB |
Output is correct |
13 |
Correct |
4 ms |
3576 KB |
Output is correct |
14 |
Correct |
4 ms |
3576 KB |
Output is correct |
15 |
Correct |
4 ms |
3576 KB |
Output is correct |
16 |
Correct |
4 ms |
3576 KB |
Output is correct |
17 |
Correct |
4 ms |
3448 KB |
Output is correct |
18 |
Correct |
5 ms |
3576 KB |
Output is correct |
19 |
Correct |
4 ms |
3448 KB |
Output is correct |
20 |
Correct |
5 ms |
3576 KB |
Output is correct |
21 |
Correct |
4 ms |
3448 KB |
Output is correct |
22 |
Correct |
4 ms |
3576 KB |
Output is correct |
23 |
Correct |
4 ms |
3448 KB |
Output is correct |
24 |
Correct |
4 ms |
3576 KB |
Output is correct |
25 |
Correct |
4 ms |
3448 KB |
Output is correct |
26 |
Correct |
4 ms |
3448 KB |
Output is correct |
27 |
Correct |
4 ms |
3448 KB |
Output is correct |
28 |
Correct |
4 ms |
3448 KB |
Output is correct |
29 |
Correct |
4 ms |
3448 KB |
Output is correct |
30 |
Correct |
4 ms |
3448 KB |
Output is correct |
31 |
Correct |
4 ms |
3576 KB |
Output is correct |
32 |
Correct |
4 ms |
3576 KB |
Output is correct |
33 |
Correct |
4 ms |
3448 KB |
Output is correct |
34 |
Correct |
4 ms |
3576 KB |
Output is correct |
35 |
Correct |
5 ms |
3448 KB |
Output is correct |
36 |
Correct |
4 ms |
3448 KB |
Output is correct |
37 |
Correct |
4 ms |
3452 KB |
Output is correct |
38 |
Correct |
4 ms |
3576 KB |
Output is correct |
39 |
Correct |
4 ms |
3448 KB |
Output is correct |
40 |
Correct |
4 ms |
3576 KB |
Output is correct |
41 |
Correct |
4 ms |
3576 KB |
Output is correct |
42 |
Correct |
4 ms |
3576 KB |
Output is correct |
43 |
Correct |
4 ms |
3448 KB |
Output is correct |
44 |
Correct |
4 ms |
3448 KB |
Output is correct |
45 |
Correct |
4 ms |
3448 KB |
Output is correct |
46 |
Correct |
3 ms |
2684 KB |
Output is correct |
47 |
Correct |
3 ms |
2680 KB |
Output is correct |
48 |
Correct |
3 ms |
2680 KB |
Output is correct |
49 |
Correct |
4 ms |
3448 KB |
Output is correct |
50 |
Correct |
4 ms |
3448 KB |
Output is correct |
51 |
Correct |
5 ms |
3540 KB |
Output is correct |
52 |
Correct |
4 ms |
3448 KB |
Output is correct |
53 |
Correct |
4 ms |
3576 KB |
Output is correct |
54 |
Correct |
3 ms |
2680 KB |
Output is correct |
55 |
Correct |
3 ms |
2680 KB |
Output is correct |
56 |
Correct |
3 ms |
2680 KB |
Output is correct |
57 |
Correct |
3 ms |
2680 KB |
Output is correct |
58 |
Correct |
3 ms |
2680 KB |
Output is correct |
59 |
Correct |
4 ms |
3496 KB |
Output is correct |
60 |
Correct |
4 ms |
3448 KB |
Output is correct |
61 |
Correct |
4 ms |
3448 KB |
Output is correct |
62 |
Correct |
4 ms |
3468 KB |
Output is correct |
63 |
Correct |
4 ms |
3448 KB |
Output is correct |
64 |
Correct |
4 ms |
3576 KB |
Output is correct |
65 |
Correct |
3 ms |
3576 KB |
Output is correct |
66 |
Correct |
4 ms |
3448 KB |
Output is correct |
67 |
Correct |
4 ms |
3448 KB |
Output is correct |
68 |
Correct |
4 ms |
3576 KB |
Output is correct |
69 |
Correct |
4 ms |
3576 KB |
Output is correct |
70 |
Correct |
4 ms |
3500 KB |
Output is correct |
71 |
Correct |
4 ms |
3448 KB |
Output is correct |
72 |
Correct |
4 ms |
3480 KB |
Output is correct |
73 |
Correct |
4 ms |
3448 KB |
Output is correct |
74 |
Correct |
4 ms |
3576 KB |
Output is correct |
75 |
Correct |
4 ms |
3448 KB |
Output is correct |
76 |
Correct |
4 ms |
3448 KB |
Output is correct |
77 |
Correct |
4 ms |
3448 KB |
Output is correct |
78 |
Correct |
4 ms |
3576 KB |
Output is correct |
79 |
Correct |
4 ms |
3580 KB |
Output is correct |
80 |
Correct |
4 ms |
3576 KB |
Output is correct |
81 |
Correct |
4 ms |
3448 KB |
Output is correct |
82 |
Correct |
4 ms |
3448 KB |
Output is correct |
83 |
Correct |
4 ms |
3448 KB |
Output is correct |
84 |
Correct |
4 ms |
3576 KB |
Output is correct |
85 |
Correct |
4 ms |
3576 KB |
Output is correct |
86 |
Correct |
4 ms |
3576 KB |
Output is correct |
87 |
Correct |
4 ms |
3576 KB |
Output is correct |
88 |
Correct |
5 ms |
3576 KB |
Output is correct |
89 |
Correct |
4 ms |
3576 KB |
Output is correct |
90 |
Correct |
4 ms |
3448 KB |
Output is correct |
91 |
Correct |
4 ms |
3576 KB |
Output is correct |
92 |
Correct |
4 ms |
3448 KB |
Output is correct |
93 |
Correct |
4 ms |
3448 KB |
Output is correct |
94 |
Correct |
3 ms |
2680 KB |
Output is correct |
95 |
Correct |
3 ms |
2680 KB |
Output is correct |
96 |
Correct |
3 ms |
2680 KB |
Output is correct |
97 |
Correct |
5 ms |
3704 KB |
Output is correct |
98 |
Correct |
5 ms |
3832 KB |
Output is correct |
99 |
Correct |
5 ms |
3768 KB |
Output is correct |
100 |
Correct |
5 ms |
3832 KB |
Output is correct |
101 |
Correct |
7 ms |
3832 KB |
Output is correct |
102 |
Correct |
5 ms |
3192 KB |
Output is correct |
103 |
Correct |
4 ms |
3064 KB |
Output is correct |
104 |
Correct |
4 ms |
3192 KB |
Output is correct |
105 |
Correct |
5 ms |
3192 KB |
Output is correct |
106 |
Correct |
5 ms |
3192 KB |
Output is correct |
107 |
Correct |
5 ms |
3832 KB |
Output is correct |
108 |
Correct |
5 ms |
3832 KB |
Output is correct |
109 |
Correct |
5 ms |
3832 KB |
Output is correct |
110 |
Correct |
5 ms |
3832 KB |
Output is correct |
111 |
Correct |
5 ms |
3832 KB |
Output is correct |
112 |
Correct |
5 ms |
3832 KB |
Output is correct |
113 |
Correct |
6 ms |
3832 KB |
Output is correct |
114 |
Correct |
6 ms |
3832 KB |
Output is correct |
115 |
Correct |
7 ms |
3832 KB |
Output is correct |
116 |
Correct |
63 ms |
3832 KB |
Output is correct |
117 |
Correct |
63 ms |
3704 KB |
Output is correct |
118 |
Correct |
6 ms |
3960 KB |
Output is correct |
119 |
Correct |
6 ms |
3960 KB |
Output is correct |
120 |
Correct |
6 ms |
3836 KB |
Output is correct |
121 |
Correct |
5 ms |
3704 KB |
Output is correct |
122 |
Correct |
6 ms |
3832 KB |
Output is correct |
123 |
Correct |
5 ms |
3832 KB |
Output is correct |
124 |
Correct |
5 ms |
3704 KB |
Output is correct |
125 |
Correct |
5 ms |
3832 KB |
Output is correct |
126 |
Correct |
5 ms |
3704 KB |
Output is correct |
127 |
Correct |
6 ms |
3704 KB |
Output is correct |
128 |
Correct |
5 ms |
3704 KB |
Output is correct |
129 |
Correct |
5 ms |
3960 KB |
Output is correct |
130 |
Correct |
5 ms |
3960 KB |
Output is correct |
131 |
Correct |
5 ms |
3960 KB |
Output is correct |
132 |
Correct |
5 ms |
3964 KB |
Output is correct |
133 |
Correct |
5 ms |
3704 KB |
Output is correct |
134 |
Correct |
5 ms |
3892 KB |
Output is correct |
135 |
Correct |
8 ms |
3832 KB |
Output is correct |
136 |
Correct |
8 ms |
3832 KB |
Output is correct |
137 |
Correct |
5 ms |
3704 KB |
Output is correct |
138 |
Correct |
5 ms |
3576 KB |
Output is correct |
139 |
Correct |
5 ms |
3580 KB |
Output is correct |
140 |
Correct |
5 ms |
3576 KB |
Output is correct |
141 |
Correct |
5 ms |
3704 KB |
Output is correct |
142 |
Correct |
4 ms |
2808 KB |
Output is correct |
143 |
Correct |
4 ms |
2936 KB |
Output is correct |
144 |
Correct |
4 ms |
2936 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
4 ms |
3448 KB |
Output is correct |
2 |
Correct |
4 ms |
3448 KB |
Output is correct |
3 |
Correct |
4 ms |
3576 KB |
Output is correct |
4 |
Correct |
4 ms |
3576 KB |
Output is correct |
5 |
Correct |
4 ms |
3576 KB |
Output is correct |
6 |
Correct |
4 ms |
2680 KB |
Output is correct |
7 |
Correct |
4 ms |
2680 KB |
Output is correct |
8 |
Correct |
3 ms |
2680 KB |
Output is correct |
9 |
Correct |
4 ms |
2680 KB |
Output is correct |
10 |
Correct |
4 ms |
2680 KB |
Output is correct |
11 |
Correct |
4 ms |
3576 KB |
Output is correct |
12 |
Correct |
5 ms |
3620 KB |
Output is correct |
13 |
Correct |
4 ms |
3576 KB |
Output is correct |
14 |
Correct |
4 ms |
3576 KB |
Output is correct |
15 |
Correct |
4 ms |
3576 KB |
Output is correct |
16 |
Correct |
4 ms |
3576 KB |
Output is correct |
17 |
Correct |
4 ms |
3448 KB |
Output is correct |
18 |
Correct |
5 ms |
3576 KB |
Output is correct |
19 |
Correct |
4 ms |
3448 KB |
Output is correct |
20 |
Correct |
5 ms |
3576 KB |
Output is correct |
21 |
Correct |
4 ms |
3448 KB |
Output is correct |
22 |
Correct |
4 ms |
3576 KB |
Output is correct |
23 |
Correct |
4 ms |
3448 KB |
Output is correct |
24 |
Correct |
4 ms |
3576 KB |
Output is correct |
25 |
Correct |
4 ms |
3448 KB |
Output is correct |
26 |
Correct |
4 ms |
3448 KB |
Output is correct |
27 |
Correct |
4 ms |
3448 KB |
Output is correct |
28 |
Correct |
4 ms |
3448 KB |
Output is correct |
29 |
Correct |
4 ms |
3448 KB |
Output is correct |
30 |
Correct |
4 ms |
3448 KB |
Output is correct |
31 |
Correct |
4 ms |
3576 KB |
Output is correct |
32 |
Correct |
4 ms |
3576 KB |
Output is correct |
33 |
Correct |
4 ms |
3448 KB |
Output is correct |
34 |
Correct |
4 ms |
3576 KB |
Output is correct |
35 |
Correct |
5 ms |
3448 KB |
Output is correct |
36 |
Correct |
4 ms |
3448 KB |
Output is correct |
37 |
Correct |
4 ms |
3452 KB |
Output is correct |
38 |
Correct |
4 ms |
3576 KB |
Output is correct |
39 |
Correct |
4 ms |
3448 KB |
Output is correct |
40 |
Correct |
4 ms |
3576 KB |
Output is correct |
41 |
Correct |
4 ms |
3576 KB |
Output is correct |
42 |
Correct |
4 ms |
3576 KB |
Output is correct |
43 |
Correct |
4 ms |
3448 KB |
Output is correct |
44 |
Correct |
4 ms |
3448 KB |
Output is correct |
45 |
Correct |
4 ms |
3448 KB |
Output is correct |
46 |
Correct |
3 ms |
2684 KB |
Output is correct |
47 |
Correct |
3 ms |
2680 KB |
Output is correct |
48 |
Correct |
3 ms |
2680 KB |
Output is correct |
49 |
Correct |
4 ms |
3448 KB |
Output is correct |
50 |
Correct |
4 ms |
3448 KB |
Output is correct |
51 |
Correct |
5 ms |
3540 KB |
Output is correct |
52 |
Correct |
4 ms |
3448 KB |
Output is correct |
53 |
Correct |
4 ms |
3576 KB |
Output is correct |
54 |
Correct |
3 ms |
2680 KB |
Output is correct |
55 |
Correct |
3 ms |
2680 KB |
Output is correct |
56 |
Correct |
3 ms |
2680 KB |
Output is correct |
57 |
Correct |
3 ms |
2680 KB |
Output is correct |
58 |
Correct |
3 ms |
2680 KB |
Output is correct |
59 |
Correct |
4 ms |
3496 KB |
Output is correct |
60 |
Correct |
4 ms |
3448 KB |
Output is correct |
61 |
Correct |
4 ms |
3448 KB |
Output is correct |
62 |
Correct |
4 ms |
3468 KB |
Output is correct |
63 |
Correct |
4 ms |
3448 KB |
Output is correct |
64 |
Correct |
4 ms |
3576 KB |
Output is correct |
65 |
Correct |
3 ms |
3576 KB |
Output is correct |
66 |
Correct |
4 ms |
3448 KB |
Output is correct |
67 |
Correct |
4 ms |
3448 KB |
Output is correct |
68 |
Correct |
4 ms |
3576 KB |
Output is correct |
69 |
Correct |
4 ms |
3576 KB |
Output is correct |
70 |
Correct |
4 ms |
3500 KB |
Output is correct |
71 |
Correct |
4 ms |
3448 KB |
Output is correct |
72 |
Correct |
4 ms |
3480 KB |
Output is correct |
73 |
Correct |
4 ms |
3448 KB |
Output is correct |
74 |
Correct |
4 ms |
3576 KB |
Output is correct |
75 |
Correct |
4 ms |
3448 KB |
Output is correct |
76 |
Correct |
4 ms |
3448 KB |
Output is correct |
77 |
Correct |
4 ms |
3448 KB |
Output is correct |
78 |
Correct |
4 ms |
3576 KB |
Output is correct |
79 |
Correct |
4 ms |
3580 KB |
Output is correct |
80 |
Correct |
4 ms |
3576 KB |
Output is correct |
81 |
Correct |
4 ms |
3448 KB |
Output is correct |
82 |
Correct |
4 ms |
3448 KB |
Output is correct |
83 |
Correct |
4 ms |
3448 KB |
Output is correct |
84 |
Correct |
4 ms |
3576 KB |
Output is correct |
85 |
Correct |
4 ms |
3576 KB |
Output is correct |
86 |
Correct |
4 ms |
3576 KB |
Output is correct |
87 |
Correct |
4 ms |
3576 KB |
Output is correct |
88 |
Correct |
5 ms |
3576 KB |
Output is correct |
89 |
Correct |
4 ms |
3576 KB |
Output is correct |
90 |
Correct |
4 ms |
3448 KB |
Output is correct |
91 |
Correct |
4 ms |
3576 KB |
Output is correct |
92 |
Correct |
4 ms |
3448 KB |
Output is correct |
93 |
Correct |
4 ms |
3448 KB |
Output is correct |
94 |
Correct |
3 ms |
2680 KB |
Output is correct |
95 |
Correct |
3 ms |
2680 KB |
Output is correct |
96 |
Correct |
3 ms |
2680 KB |
Output is correct |
97 |
Correct |
5 ms |
3704 KB |
Output is correct |
98 |
Correct |
5 ms |
3832 KB |
Output is correct |
99 |
Correct |
5 ms |
3768 KB |
Output is correct |
100 |
Correct |
5 ms |
3832 KB |
Output is correct |
101 |
Correct |
7 ms |
3832 KB |
Output is correct |
102 |
Correct |
5 ms |
3192 KB |
Output is correct |
103 |
Correct |
4 ms |
3064 KB |
Output is correct |
104 |
Correct |
4 ms |
3192 KB |
Output is correct |
105 |
Correct |
5 ms |
3192 KB |
Output is correct |
106 |
Correct |
5 ms |
3192 KB |
Output is correct |
107 |
Correct |
5 ms |
3832 KB |
Output is correct |
108 |
Correct |
5 ms |
3832 KB |
Output is correct |
109 |
Correct |
5 ms |
3832 KB |
Output is correct |
110 |
Correct |
5 ms |
3832 KB |
Output is correct |
111 |
Correct |
5 ms |
3832 KB |
Output is correct |
112 |
Correct |
5 ms |
3832 KB |
Output is correct |
113 |
Correct |
6 ms |
3832 KB |
Output is correct |
114 |
Correct |
6 ms |
3832 KB |
Output is correct |
115 |
Correct |
7 ms |
3832 KB |
Output is correct |
116 |
Correct |
63 ms |
3832 KB |
Output is correct |
117 |
Correct |
63 ms |
3704 KB |
Output is correct |
118 |
Correct |
6 ms |
3960 KB |
Output is correct |
119 |
Correct |
6 ms |
3960 KB |
Output is correct |
120 |
Correct |
6 ms |
3836 KB |
Output is correct |
121 |
Correct |
5 ms |
3704 KB |
Output is correct |
122 |
Correct |
6 ms |
3832 KB |
Output is correct |
123 |
Correct |
5 ms |
3832 KB |
Output is correct |
124 |
Correct |
5 ms |
3704 KB |
Output is correct |
125 |
Correct |
5 ms |
3832 KB |
Output is correct |
126 |
Correct |
5 ms |
3704 KB |
Output is correct |
127 |
Correct |
6 ms |
3704 KB |
Output is correct |
128 |
Correct |
5 ms |
3704 KB |
Output is correct |
129 |
Correct |
5 ms |
3960 KB |
Output is correct |
130 |
Correct |
5 ms |
3960 KB |
Output is correct |
131 |
Correct |
5 ms |
3960 KB |
Output is correct |
132 |
Correct |
5 ms |
3964 KB |
Output is correct |
133 |
Correct |
5 ms |
3704 KB |
Output is correct |
134 |
Correct |
5 ms |
3892 KB |
Output is correct |
135 |
Correct |
8 ms |
3832 KB |
Output is correct |
136 |
Correct |
8 ms |
3832 KB |
Output is correct |
137 |
Correct |
5 ms |
3704 KB |
Output is correct |
138 |
Correct |
5 ms |
3576 KB |
Output is correct |
139 |
Correct |
5 ms |
3580 KB |
Output is correct |
140 |
Correct |
5 ms |
3576 KB |
Output is correct |
141 |
Correct |
5 ms |
3704 KB |
Output is correct |
142 |
Correct |
4 ms |
2808 KB |
Output is correct |
143 |
Correct |
4 ms |
2936 KB |
Output is correct |
144 |
Correct |
4 ms |
2936 KB |
Output is correct |
145 |
Correct |
65 ms |
12792 KB |
Output is correct |
146 |
Correct |
50 ms |
12656 KB |
Output is correct |
147 |
Correct |
51 ms |
12372 KB |
Output is correct |
148 |
Correct |
61 ms |
12064 KB |
Output is correct |
149 |
Correct |
74 ms |
12288 KB |
Output is correct |
150 |
Correct |
64 ms |
16232 KB |
Output is correct |
151 |
Correct |
72 ms |
16232 KB |
Output is correct |
152 |
Correct |
59 ms |
16208 KB |
Output is correct |
153 |
Correct |
69 ms |
16232 KB |
Output is correct |
154 |
Correct |
68 ms |
16232 KB |
Output is correct |
155 |
Correct |
60 ms |
15596 KB |
Output is correct |
156 |
Correct |
58 ms |
15472 KB |
Output is correct |
157 |
Correct |
64 ms |
15472 KB |
Output is correct |
158 |
Correct |
49 ms |
15472 KB |
Output is correct |
159 |
Correct |
54 ms |
15420 KB |
Output is correct |
160 |
Correct |
57 ms |
15472 KB |
Output is correct |
161 |
Correct |
56 ms |
15348 KB |
Output is correct |
162 |
Correct |
44 ms |
14700 KB |
Output is correct |
163 |
Correct |
60 ms |
14832 KB |
Output is correct |
164 |
Execution timed out |
1077 ms |
12984 KB |
Time limit exceeded |
165 |
Halted |
0 ms |
0 KB |
- |