#include <bits/stdc++.h>
using namespace std;
int n, m;
typedef vector<int> vi;
typedef pair<int,int> ii;
struct node{
int depth = -1;
int low;
int parent;
bool vis = false;
bool isArti = false;
vi adj;
};
vector<unordered_set<int> > biconnected;
stack<int> s; ///this is only needed for biconnected components
///note: this will ignore single nodes with no edges
static node g[200005];
int rootChildren = 0;
void dfs(int u){
if(g[u].depth == -1) g[u].depth = g[g[u].parent].depth + 1;
g[u].low = g[u].depth;
g[u].vis = true;
s.push(u);
for(int i = 0;i < g[u].adj.size();i++){
int v = g[u].adj[i];
if(!g[v].vis){
g[v].parent = u;
if(g[u].depth == 0) rootChildren++;
dfs(v);
g[u].low = min(g[u].low,g[v].low);
if(g[v].low >= g[u].depth){
g[u].isArti = true;
g[u].low = min(g[u].low,g[v].low);
unordered_set<int> newSet;
int nn;
biconnected.push_back(newSet); ///create new biconnected component
while(true){
assert(!s.empty());
nn = s.top();
s.pop();
biconnected.back().insert(nn);
if(nn == v) break;
}
biconnected.back().insert(u);
}
}
else if(v != g[u].parent){
g[u].low = min(g[u].low,g[v].depth); ///g[v].depth not num!!!!!!
}
}
}
struct node2{
long long sz;
long long dp = 0;
bool isArti = false;
bool vis = false;
int r;
int p = -1;
vi adj;
};
vector<node2> bct; ///block-cut tree
long long root = -1;
void dp(int u){
if(bct[u].vis) return;
bct[u].vis = true;
bct[u].dp = bct[u].sz;
bct[u].r = root;
for(int i = 0;i < bct[u].adj.size();i++){
int v = bct[u].adj[i];
if(bct[v].vis) continue;
bct[v].p = u;
dp(v);
bct[u].dp += bct[v].dp;
}
}
int main()
{
cin >> n >> m;
ii edges[m];
for(int i = 0;i < m;i++){
int a, b;
cin >> a >> b;
a--;
b--;
g[a].adj.push_back(b);
g[b].adj.push_back(a);
edges[i] = ii(a,b);
}
for(int i = 0;i < n;i++){
if(!g[i].vis){
rootChildren = 0;
g[i].depth = 0;
dfs(i);
if(rootChildren > 1) g[i].isArti = true;
else g[i].isArti = false; ///this line is needed
}
}
unordered_map<int,int> artis;
for(int i = 0;i < n;i++){
if(g[i].isArti){
artis[i] = bct.size();
node2 nn;
nn.sz = 1;
nn.isArti = true;
bct.push_back(nn);
}
}
for(int i = 0;i < biconnected.size();i++){
node2 nn;
nn.sz = biconnected[i].size();
nn.isArti = false;
for(unordered_set<int>::iterator it = biconnected[i].begin();it != biconnected[i].end();it++){
if(artis.find(*it) != artis.end()){
nn.adj.push_back(artis[*it]);
bct[artis[*it]].adj.push_back(bct.size());
nn.sz--;
}
}
bct.push_back(nn);
}
for(int i = 0;i < bct.size();i++){
root = i;
dp(i);
}
long long ans = 0ll;
for(int i = 0;i < bct.size();i++){
vector<long long> branches;
vector<long long> branchStart;
long long total = 0ll;
for(int j = 0;j < bct[i].adj.size();j++){
if(bct[i].adj[j] != bct[i].p){
branches.push_back(bct[bct[i].adj[j]].dp);
branchStart.push_back(bct[bct[i].adj[j]].sz);
}
}
if(bct[i].p >= 0){
branches.push_back(bct[bct[i].r].dp - bct[i].dp);
branchStart.push_back(bct[bct[i].p].sz);
}
for(int j = 0;j < branches.size();j++) total += branches[j];
long long extra = 0ll;
if(!bct[i].isArti) extra = max(0ll,(long long)(bct[i].adj.size())-2);
for(int j = 0;j < branches.size();j++){
///branch1 to self or neighbor articulation point to branch2
ans += branches[j] * (total - branches[j]) * (bct[i].sz + extra);
///branch to self to self or self to self to branch
ans += 2 * (bct[i].sz) * (bct[i].sz - 1) * branches[j];
if(bct[i].isArti){
///direct branch to self to same branch(not reverse) or its reverse
ans += 2ll * bct[i].sz * branchStart[j] * (branches[j] - branchStart[j]);
///direct branch to self to direct or its reverse
ans += bct[i].sz * (branchStart[j]) * (branchStart[j] - 1);
}
}
///self to self to self
ans += (bct[i].sz) * (bct[i].sz - 1) * (bct[i].sz - 2);
}
cout << ans;
}
Compilation message
count_triplets.cpp: In function 'void dfs(int)':
count_triplets.cpp:25:19: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
25 | for(int i = 0;i < g[u].adj.size();i++){
| ~~^~~~~~~~~~~~~~~~~
count_triplets.cpp: In function 'void dp(int)':
count_triplets.cpp:72:19: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
72 | for(int i = 0;i < bct[u].adj.size();i++){
| ~~^~~~~~~~~~~~~~~~~~~
count_triplets.cpp: In function 'int main()':
count_triplets.cpp:115:19: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<std::unordered_set<int> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
115 | for(int i = 0;i < biconnected.size();i++){
| ~~^~~~~~~~~~~~~~~~~~~~
count_triplets.cpp:128:19: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<node2>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
128 | for(int i = 0;i < bct.size();i++){
| ~~^~~~~~~~~~~~
count_triplets.cpp:134:19: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<node2>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
134 | for(int i = 0;i < bct.size();i++){
| ~~^~~~~~~~~~~~
count_triplets.cpp:138:21: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
138 | for(int j = 0;j < bct[i].adj.size();j++){
| ~~^~~~~~~~~~~~~~~~~~~
count_triplets.cpp:148:21: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<long long int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
148 | for(int j = 0;j < branches.size();j++) total += branches[j];
| ~~^~~~~~~~~~~~~~~~~
count_triplets.cpp:151:21: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<long long int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
151 | for(int j = 0;j < branches.size();j++){
| ~~^~~~~~~~~~~~~~~~~
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
6 ms |
8172 KB |
Output is correct |
2 |
Correct |
6 ms |
8172 KB |
Output is correct |
3 |
Correct |
6 ms |
8172 KB |
Output is correct |
4 |
Correct |
6 ms |
8172 KB |
Output is correct |
5 |
Correct |
6 ms |
8172 KB |
Output is correct |
6 |
Correct |
5 ms |
8172 KB |
Output is correct |
7 |
Correct |
6 ms |
8300 KB |
Output is correct |
8 |
Correct |
6 ms |
8172 KB |
Output is correct |
9 |
Correct |
7 ms |
8172 KB |
Output is correct |
10 |
Correct |
6 ms |
8172 KB |
Output is correct |
11 |
Correct |
6 ms |
8172 KB |
Output is correct |
12 |
Correct |
6 ms |
8172 KB |
Output is correct |
13 |
Correct |
7 ms |
8172 KB |
Output is correct |
14 |
Correct |
6 ms |
8172 KB |
Output is correct |
15 |
Correct |
6 ms |
8172 KB |
Output is correct |
16 |
Correct |
6 ms |
8172 KB |
Output is correct |
17 |
Correct |
6 ms |
8172 KB |
Output is correct |
18 |
Correct |
6 ms |
8192 KB |
Output is correct |
19 |
Correct |
6 ms |
8172 KB |
Output is correct |
20 |
Correct |
6 ms |
8172 KB |
Output is correct |
21 |
Correct |
6 ms |
8172 KB |
Output is correct |
22 |
Correct |
6 ms |
8172 KB |
Output is correct |
23 |
Correct |
6 ms |
8300 KB |
Output is correct |
24 |
Correct |
6 ms |
8172 KB |
Output is correct |
25 |
Correct |
6 ms |
8172 KB |
Output is correct |
26 |
Correct |
6 ms |
8172 KB |
Output is correct |
27 |
Correct |
6 ms |
8172 KB |
Output is correct |
28 |
Correct |
6 ms |
8172 KB |
Output is correct |
29 |
Correct |
6 ms |
8172 KB |
Output is correct |
30 |
Correct |
6 ms |
8172 KB |
Output is correct |
31 |
Correct |
7 ms |
8172 KB |
Output is correct |
32 |
Correct |
6 ms |
8172 KB |
Output is correct |
33 |
Correct |
7 ms |
8172 KB |
Output is correct |
34 |
Correct |
6 ms |
8172 KB |
Output is correct |
35 |
Correct |
5 ms |
8172 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
6 ms |
8172 KB |
Output is correct |
2 |
Correct |
6 ms |
8172 KB |
Output is correct |
3 |
Correct |
6 ms |
8172 KB |
Output is correct |
4 |
Correct |
6 ms |
8172 KB |
Output is correct |
5 |
Correct |
6 ms |
8172 KB |
Output is correct |
6 |
Correct |
5 ms |
8172 KB |
Output is correct |
7 |
Correct |
6 ms |
8300 KB |
Output is correct |
8 |
Correct |
6 ms |
8172 KB |
Output is correct |
9 |
Correct |
7 ms |
8172 KB |
Output is correct |
10 |
Correct |
6 ms |
8172 KB |
Output is correct |
11 |
Correct |
6 ms |
8172 KB |
Output is correct |
12 |
Correct |
6 ms |
8172 KB |
Output is correct |
13 |
Correct |
7 ms |
8172 KB |
Output is correct |
14 |
Correct |
6 ms |
8172 KB |
Output is correct |
15 |
Correct |
6 ms |
8172 KB |
Output is correct |
16 |
Correct |
6 ms |
8172 KB |
Output is correct |
17 |
Correct |
6 ms |
8172 KB |
Output is correct |
18 |
Correct |
6 ms |
8192 KB |
Output is correct |
19 |
Correct |
6 ms |
8172 KB |
Output is correct |
20 |
Correct |
6 ms |
8172 KB |
Output is correct |
21 |
Correct |
6 ms |
8172 KB |
Output is correct |
22 |
Correct |
6 ms |
8172 KB |
Output is correct |
23 |
Correct |
6 ms |
8300 KB |
Output is correct |
24 |
Correct |
6 ms |
8172 KB |
Output is correct |
25 |
Correct |
6 ms |
8172 KB |
Output is correct |
26 |
Correct |
6 ms |
8172 KB |
Output is correct |
27 |
Correct |
6 ms |
8172 KB |
Output is correct |
28 |
Correct |
6 ms |
8172 KB |
Output is correct |
29 |
Correct |
6 ms |
8172 KB |
Output is correct |
30 |
Correct |
6 ms |
8172 KB |
Output is correct |
31 |
Correct |
7 ms |
8172 KB |
Output is correct |
32 |
Correct |
6 ms |
8172 KB |
Output is correct |
33 |
Correct |
7 ms |
8172 KB |
Output is correct |
34 |
Correct |
6 ms |
8172 KB |
Output is correct |
35 |
Correct |
5 ms |
8172 KB |
Output is correct |
36 |
Correct |
6 ms |
8172 KB |
Output is correct |
37 |
Correct |
6 ms |
8172 KB |
Output is correct |
38 |
Correct |
6 ms |
8172 KB |
Output is correct |
39 |
Correct |
6 ms |
8172 KB |
Output is correct |
40 |
Correct |
6 ms |
8172 KB |
Output is correct |
41 |
Correct |
6 ms |
8172 KB |
Output is correct |
42 |
Correct |
7 ms |
8172 KB |
Output is correct |
43 |
Correct |
6 ms |
8172 KB |
Output is correct |
44 |
Correct |
6 ms |
8172 KB |
Output is correct |
45 |
Correct |
6 ms |
8200 KB |
Output is correct |
46 |
Correct |
6 ms |
8172 KB |
Output is correct |
47 |
Correct |
7 ms |
8172 KB |
Output is correct |
48 |
Correct |
6 ms |
8172 KB |
Output is correct |
49 |
Correct |
6 ms |
8172 KB |
Output is correct |
50 |
Correct |
6 ms |
8172 KB |
Output is correct |
51 |
Correct |
6 ms |
8172 KB |
Output is correct |
52 |
Correct |
6 ms |
8172 KB |
Output is correct |
53 |
Correct |
7 ms |
8172 KB |
Output is correct |
54 |
Correct |
6 ms |
8172 KB |
Output is correct |
55 |
Correct |
6 ms |
8172 KB |
Output is correct |
56 |
Correct |
6 ms |
8172 KB |
Output is correct |
57 |
Correct |
6 ms |
8172 KB |
Output is correct |
58 |
Correct |
6 ms |
8172 KB |
Output is correct |
59 |
Correct |
6 ms |
8172 KB |
Output is correct |
60 |
Correct |
6 ms |
8172 KB |
Output is correct |
61 |
Correct |
6 ms |
8172 KB |
Output is correct |
62 |
Correct |
9 ms |
8172 KB |
Output is correct |
63 |
Correct |
6 ms |
8320 KB |
Output is correct |
64 |
Correct |
6 ms |
8172 KB |
Output is correct |
65 |
Correct |
6 ms |
8172 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
165 ms |
31816 KB |
Output is correct |
2 |
Correct |
157 ms |
33180 KB |
Output is correct |
3 |
Correct |
223 ms |
41900 KB |
Output is correct |
4 |
Correct |
185 ms |
37612 KB |
Output is correct |
5 |
Correct |
205 ms |
37804 KB |
Output is correct |
6 |
Correct |
276 ms |
40612 KB |
Output is correct |
7 |
Correct |
269 ms |
39864 KB |
Output is correct |
8 |
Correct |
253 ms |
41140 KB |
Output is correct |
9 |
Correct |
250 ms |
38328 KB |
Output is correct |
10 |
Correct |
226 ms |
37180 KB |
Output is correct |
11 |
Correct |
184 ms |
32284 KB |
Output is correct |
12 |
Correct |
169 ms |
32060 KB |
Output is correct |
13 |
Correct |
142 ms |
31548 KB |
Output is correct |
14 |
Correct |
156 ms |
31148 KB |
Output is correct |
15 |
Correct |
104 ms |
24924 KB |
Output is correct |
16 |
Correct |
118 ms |
24624 KB |
Output is correct |
17 |
Correct |
9 ms |
8684 KB |
Output is correct |
18 |
Correct |
9 ms |
8812 KB |
Output is correct |
19 |
Correct |
8 ms |
8556 KB |
Output is correct |
20 |
Correct |
8 ms |
8556 KB |
Output is correct |
21 |
Correct |
8 ms |
8556 KB |
Output is correct |
22 |
Correct |
8 ms |
8556 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
8 ms |
8556 KB |
Output is correct |
2 |
Correct |
7 ms |
8556 KB |
Output is correct |
3 |
Correct |
8 ms |
8556 KB |
Output is correct |
4 |
Correct |
8 ms |
8684 KB |
Output is correct |
5 |
Correct |
7 ms |
8684 KB |
Output is correct |
6 |
Correct |
8 ms |
8556 KB |
Output is correct |
7 |
Correct |
8 ms |
8684 KB |
Output is correct |
8 |
Correct |
8 ms |
8556 KB |
Output is correct |
9 |
Correct |
8 ms |
8556 KB |
Output is correct |
10 |
Correct |
8 ms |
8556 KB |
Output is correct |
11 |
Correct |
8 ms |
8556 KB |
Output is correct |
12 |
Correct |
8 ms |
8556 KB |
Output is correct |
13 |
Correct |
7 ms |
8556 KB |
Output is correct |
14 |
Correct |
7 ms |
8556 KB |
Output is correct |
15 |
Correct |
7 ms |
8428 KB |
Output is correct |
16 |
Correct |
6 ms |
8300 KB |
Output is correct |
17 |
Correct |
8 ms |
8428 KB |
Output is correct |
18 |
Correct |
7 ms |
8428 KB |
Output is correct |
19 |
Correct |
7 ms |
8428 KB |
Output is correct |
20 |
Correct |
7 ms |
8428 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
272 ms |
48560 KB |
Output is correct |
2 |
Correct |
275 ms |
49984 KB |
Output is correct |
3 |
Correct |
272 ms |
49840 KB |
Output is correct |
4 |
Correct |
278 ms |
49960 KB |
Output is correct |
5 |
Correct |
257 ms |
49968 KB |
Output is correct |
6 |
Correct |
334 ms |
59568 KB |
Output is correct |
7 |
Correct |
317 ms |
56496 KB |
Output is correct |
8 |
Correct |
293 ms |
55012 KB |
Output is correct |
9 |
Correct |
294 ms |
53552 KB |
Output is correct |
10 |
Correct |
273 ms |
49968 KB |
Output is correct |
11 |
Correct |
283 ms |
49840 KB |
Output is correct |
12 |
Correct |
274 ms |
49840 KB |
Output is correct |
13 |
Correct |
284 ms |
49840 KB |
Output is correct |
14 |
Correct |
251 ms |
48176 KB |
Output is correct |
15 |
Correct |
225 ms |
38704 KB |
Output is correct |
16 |
Correct |
129 ms |
30012 KB |
Output is correct |
17 |
Correct |
183 ms |
41224 KB |
Output is correct |
18 |
Correct |
174 ms |
41260 KB |
Output is correct |
19 |
Correct |
167 ms |
41248 KB |
Output is correct |
20 |
Correct |
190 ms |
41296 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
9 ms |
8480 KB |
Output is correct |
2 |
Correct |
7 ms |
8556 KB |
Output is correct |
3 |
Correct |
7 ms |
8556 KB |
Output is correct |
4 |
Correct |
8 ms |
8428 KB |
Output is correct |
5 |
Correct |
9 ms |
8428 KB |
Output is correct |
6 |
Correct |
7 ms |
8300 KB |
Output is correct |
7 |
Correct |
8 ms |
8300 KB |
Output is correct |
8 |
Correct |
7 ms |
8300 KB |
Output is correct |
9 |
Correct |
8 ms |
8304 KB |
Output is correct |
10 |
Correct |
7 ms |
8300 KB |
Output is correct |
11 |
Correct |
8 ms |
8564 KB |
Output is correct |
12 |
Correct |
8 ms |
8556 KB |
Output is correct |
13 |
Correct |
8 ms |
8556 KB |
Output is correct |
14 |
Correct |
8 ms |
8500 KB |
Output is correct |
15 |
Correct |
8 ms |
8556 KB |
Output is correct |
16 |
Correct |
8 ms |
8428 KB |
Output is correct |
17 |
Correct |
8 ms |
8428 KB |
Output is correct |
18 |
Correct |
8 ms |
8428 KB |
Output is correct |
19 |
Correct |
8 ms |
8352 KB |
Output is correct |
20 |
Correct |
7 ms |
8300 KB |
Output is correct |
21 |
Correct |
8 ms |
8556 KB |
Output is correct |
22 |
Correct |
8 ms |
8556 KB |
Output is correct |
23 |
Correct |
8 ms |
8428 KB |
Output is correct |
24 |
Correct |
8 ms |
8428 KB |
Output is correct |
25 |
Correct |
6 ms |
8172 KB |
Output is correct |
26 |
Correct |
6 ms |
8192 KB |
Output is correct |
27 |
Correct |
6 ms |
8172 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
282 ms |
48560 KB |
Output is correct |
2 |
Correct |
311 ms |
49784 KB |
Output is correct |
3 |
Correct |
330 ms |
48432 KB |
Output is correct |
4 |
Correct |
251 ms |
35128 KB |
Output is correct |
5 |
Correct |
204 ms |
28536 KB |
Output is correct |
6 |
Correct |
199 ms |
25920 KB |
Output is correct |
7 |
Correct |
173 ms |
25280 KB |
Output is correct |
8 |
Correct |
181 ms |
21956 KB |
Output is correct |
9 |
Correct |
168 ms |
21700 KB |
Output is correct |
10 |
Correct |
155 ms |
20164 KB |
Output is correct |
11 |
Correct |
139 ms |
18952 KB |
Output is correct |
12 |
Correct |
138 ms |
18412 KB |
Output is correct |
13 |
Correct |
166 ms |
18540 KB |
Output is correct |
14 |
Correct |
150 ms |
21868 KB |
Output is correct |
15 |
Correct |
310 ms |
55856 KB |
Output is correct |
16 |
Correct |
290 ms |
53680 KB |
Output is correct |
17 |
Correct |
289 ms |
45644 KB |
Output is correct |
18 |
Correct |
287 ms |
43464 KB |
Output is correct |
19 |
Correct |
261 ms |
35128 KB |
Output is correct |
20 |
Correct |
258 ms |
35244 KB |
Output is correct |
21 |
Correct |
249 ms |
35252 KB |
Output is correct |
22 |
Correct |
214 ms |
33340 KB |
Output is correct |
23 |
Correct |
171 ms |
27836 KB |
Output is correct |
24 |
Correct |
240 ms |
40624 KB |
Output is correct |
25 |
Correct |
240 ms |
40680 KB |
Output is correct |
26 |
Correct |
227 ms |
38448 KB |
Output is correct |
27 |
Correct |
247 ms |
38192 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
6 ms |
8172 KB |
Output is correct |
2 |
Correct |
6 ms |
8172 KB |
Output is correct |
3 |
Correct |
6 ms |
8172 KB |
Output is correct |
4 |
Correct |
6 ms |
8172 KB |
Output is correct |
5 |
Correct |
6 ms |
8172 KB |
Output is correct |
6 |
Correct |
5 ms |
8172 KB |
Output is correct |
7 |
Correct |
6 ms |
8300 KB |
Output is correct |
8 |
Correct |
6 ms |
8172 KB |
Output is correct |
9 |
Correct |
7 ms |
8172 KB |
Output is correct |
10 |
Correct |
6 ms |
8172 KB |
Output is correct |
11 |
Correct |
6 ms |
8172 KB |
Output is correct |
12 |
Correct |
6 ms |
8172 KB |
Output is correct |
13 |
Correct |
7 ms |
8172 KB |
Output is correct |
14 |
Correct |
6 ms |
8172 KB |
Output is correct |
15 |
Correct |
6 ms |
8172 KB |
Output is correct |
16 |
Correct |
6 ms |
8172 KB |
Output is correct |
17 |
Correct |
6 ms |
8172 KB |
Output is correct |
18 |
Correct |
6 ms |
8192 KB |
Output is correct |
19 |
Correct |
6 ms |
8172 KB |
Output is correct |
20 |
Correct |
6 ms |
8172 KB |
Output is correct |
21 |
Correct |
6 ms |
8172 KB |
Output is correct |
22 |
Correct |
6 ms |
8172 KB |
Output is correct |
23 |
Correct |
6 ms |
8300 KB |
Output is correct |
24 |
Correct |
6 ms |
8172 KB |
Output is correct |
25 |
Correct |
6 ms |
8172 KB |
Output is correct |
26 |
Correct |
6 ms |
8172 KB |
Output is correct |
27 |
Correct |
6 ms |
8172 KB |
Output is correct |
28 |
Correct |
6 ms |
8172 KB |
Output is correct |
29 |
Correct |
6 ms |
8172 KB |
Output is correct |
30 |
Correct |
6 ms |
8172 KB |
Output is correct |
31 |
Correct |
7 ms |
8172 KB |
Output is correct |
32 |
Correct |
6 ms |
8172 KB |
Output is correct |
33 |
Correct |
7 ms |
8172 KB |
Output is correct |
34 |
Correct |
6 ms |
8172 KB |
Output is correct |
35 |
Correct |
5 ms |
8172 KB |
Output is correct |
36 |
Correct |
6 ms |
8172 KB |
Output is correct |
37 |
Correct |
6 ms |
8172 KB |
Output is correct |
38 |
Correct |
6 ms |
8172 KB |
Output is correct |
39 |
Correct |
6 ms |
8172 KB |
Output is correct |
40 |
Correct |
6 ms |
8172 KB |
Output is correct |
41 |
Correct |
6 ms |
8172 KB |
Output is correct |
42 |
Correct |
7 ms |
8172 KB |
Output is correct |
43 |
Correct |
6 ms |
8172 KB |
Output is correct |
44 |
Correct |
6 ms |
8172 KB |
Output is correct |
45 |
Correct |
6 ms |
8200 KB |
Output is correct |
46 |
Correct |
6 ms |
8172 KB |
Output is correct |
47 |
Correct |
7 ms |
8172 KB |
Output is correct |
48 |
Correct |
6 ms |
8172 KB |
Output is correct |
49 |
Correct |
6 ms |
8172 KB |
Output is correct |
50 |
Correct |
6 ms |
8172 KB |
Output is correct |
51 |
Correct |
6 ms |
8172 KB |
Output is correct |
52 |
Correct |
6 ms |
8172 KB |
Output is correct |
53 |
Correct |
7 ms |
8172 KB |
Output is correct |
54 |
Correct |
6 ms |
8172 KB |
Output is correct |
55 |
Correct |
6 ms |
8172 KB |
Output is correct |
56 |
Correct |
6 ms |
8172 KB |
Output is correct |
57 |
Correct |
6 ms |
8172 KB |
Output is correct |
58 |
Correct |
6 ms |
8172 KB |
Output is correct |
59 |
Correct |
6 ms |
8172 KB |
Output is correct |
60 |
Correct |
6 ms |
8172 KB |
Output is correct |
61 |
Correct |
6 ms |
8172 KB |
Output is correct |
62 |
Correct |
9 ms |
8172 KB |
Output is correct |
63 |
Correct |
6 ms |
8320 KB |
Output is correct |
64 |
Correct |
6 ms |
8172 KB |
Output is correct |
65 |
Correct |
6 ms |
8172 KB |
Output is correct |
66 |
Correct |
6 ms |
8172 KB |
Output is correct |
67 |
Correct |
6 ms |
8300 KB |
Output is correct |
68 |
Correct |
7 ms |
8428 KB |
Output is correct |
69 |
Correct |
8 ms |
8428 KB |
Output is correct |
70 |
Correct |
9 ms |
8576 KB |
Output is correct |
71 |
Correct |
7 ms |
8300 KB |
Output is correct |
72 |
Correct |
7 ms |
8428 KB |
Output is correct |
73 |
Correct |
7 ms |
8300 KB |
Output is correct |
74 |
Correct |
7 ms |
8300 KB |
Output is correct |
75 |
Correct |
9 ms |
8260 KB |
Output is correct |
76 |
Correct |
6 ms |
8172 KB |
Output is correct |
77 |
Correct |
7 ms |
8428 KB |
Output is correct |
78 |
Correct |
7 ms |
8428 KB |
Output is correct |
79 |
Correct |
7 ms |
8300 KB |
Output is correct |
80 |
Correct |
7 ms |
8300 KB |
Output is correct |
81 |
Correct |
8 ms |
8428 KB |
Output is correct |
82 |
Correct |
7 ms |
8300 KB |
Output is correct |
83 |
Correct |
7 ms |
8300 KB |
Output is correct |
84 |
Correct |
7 ms |
8428 KB |
Output is correct |
85 |
Correct |
7 ms |
8428 KB |
Output is correct |
86 |
Correct |
7 ms |
8428 KB |
Output is correct |
87 |
Correct |
7 ms |
8300 KB |
Output is correct |
88 |
Correct |
7 ms |
8300 KB |
Output is correct |
89 |
Correct |
7 ms |
8300 KB |
Output is correct |
90 |
Correct |
6 ms |
8300 KB |
Output is correct |
91 |
Correct |
7 ms |
8300 KB |
Output is correct |
92 |
Correct |
7 ms |
8300 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
6 ms |
8172 KB |
Output is correct |
2 |
Correct |
6 ms |
8172 KB |
Output is correct |
3 |
Correct |
6 ms |
8172 KB |
Output is correct |
4 |
Correct |
6 ms |
8172 KB |
Output is correct |
5 |
Correct |
6 ms |
8172 KB |
Output is correct |
6 |
Correct |
5 ms |
8172 KB |
Output is correct |
7 |
Correct |
6 ms |
8300 KB |
Output is correct |
8 |
Correct |
6 ms |
8172 KB |
Output is correct |
9 |
Correct |
7 ms |
8172 KB |
Output is correct |
10 |
Correct |
6 ms |
8172 KB |
Output is correct |
11 |
Correct |
6 ms |
8172 KB |
Output is correct |
12 |
Correct |
6 ms |
8172 KB |
Output is correct |
13 |
Correct |
7 ms |
8172 KB |
Output is correct |
14 |
Correct |
6 ms |
8172 KB |
Output is correct |
15 |
Correct |
6 ms |
8172 KB |
Output is correct |
16 |
Correct |
6 ms |
8172 KB |
Output is correct |
17 |
Correct |
6 ms |
8172 KB |
Output is correct |
18 |
Correct |
6 ms |
8192 KB |
Output is correct |
19 |
Correct |
6 ms |
8172 KB |
Output is correct |
20 |
Correct |
6 ms |
8172 KB |
Output is correct |
21 |
Correct |
6 ms |
8172 KB |
Output is correct |
22 |
Correct |
6 ms |
8172 KB |
Output is correct |
23 |
Correct |
6 ms |
8300 KB |
Output is correct |
24 |
Correct |
6 ms |
8172 KB |
Output is correct |
25 |
Correct |
6 ms |
8172 KB |
Output is correct |
26 |
Correct |
6 ms |
8172 KB |
Output is correct |
27 |
Correct |
6 ms |
8172 KB |
Output is correct |
28 |
Correct |
6 ms |
8172 KB |
Output is correct |
29 |
Correct |
6 ms |
8172 KB |
Output is correct |
30 |
Correct |
6 ms |
8172 KB |
Output is correct |
31 |
Correct |
7 ms |
8172 KB |
Output is correct |
32 |
Correct |
6 ms |
8172 KB |
Output is correct |
33 |
Correct |
7 ms |
8172 KB |
Output is correct |
34 |
Correct |
6 ms |
8172 KB |
Output is correct |
35 |
Correct |
5 ms |
8172 KB |
Output is correct |
36 |
Correct |
6 ms |
8172 KB |
Output is correct |
37 |
Correct |
6 ms |
8172 KB |
Output is correct |
38 |
Correct |
6 ms |
8172 KB |
Output is correct |
39 |
Correct |
6 ms |
8172 KB |
Output is correct |
40 |
Correct |
6 ms |
8172 KB |
Output is correct |
41 |
Correct |
6 ms |
8172 KB |
Output is correct |
42 |
Correct |
7 ms |
8172 KB |
Output is correct |
43 |
Correct |
6 ms |
8172 KB |
Output is correct |
44 |
Correct |
6 ms |
8172 KB |
Output is correct |
45 |
Correct |
6 ms |
8200 KB |
Output is correct |
46 |
Correct |
6 ms |
8172 KB |
Output is correct |
47 |
Correct |
7 ms |
8172 KB |
Output is correct |
48 |
Correct |
6 ms |
8172 KB |
Output is correct |
49 |
Correct |
6 ms |
8172 KB |
Output is correct |
50 |
Correct |
6 ms |
8172 KB |
Output is correct |
51 |
Correct |
6 ms |
8172 KB |
Output is correct |
52 |
Correct |
6 ms |
8172 KB |
Output is correct |
53 |
Correct |
7 ms |
8172 KB |
Output is correct |
54 |
Correct |
6 ms |
8172 KB |
Output is correct |
55 |
Correct |
6 ms |
8172 KB |
Output is correct |
56 |
Correct |
6 ms |
8172 KB |
Output is correct |
57 |
Correct |
6 ms |
8172 KB |
Output is correct |
58 |
Correct |
6 ms |
8172 KB |
Output is correct |
59 |
Correct |
6 ms |
8172 KB |
Output is correct |
60 |
Correct |
6 ms |
8172 KB |
Output is correct |
61 |
Correct |
6 ms |
8172 KB |
Output is correct |
62 |
Correct |
9 ms |
8172 KB |
Output is correct |
63 |
Correct |
6 ms |
8320 KB |
Output is correct |
64 |
Correct |
6 ms |
8172 KB |
Output is correct |
65 |
Correct |
6 ms |
8172 KB |
Output is correct |
66 |
Correct |
165 ms |
31816 KB |
Output is correct |
67 |
Correct |
157 ms |
33180 KB |
Output is correct |
68 |
Correct |
223 ms |
41900 KB |
Output is correct |
69 |
Correct |
185 ms |
37612 KB |
Output is correct |
70 |
Correct |
205 ms |
37804 KB |
Output is correct |
71 |
Correct |
276 ms |
40612 KB |
Output is correct |
72 |
Correct |
269 ms |
39864 KB |
Output is correct |
73 |
Correct |
253 ms |
41140 KB |
Output is correct |
74 |
Correct |
250 ms |
38328 KB |
Output is correct |
75 |
Correct |
226 ms |
37180 KB |
Output is correct |
76 |
Correct |
184 ms |
32284 KB |
Output is correct |
77 |
Correct |
169 ms |
32060 KB |
Output is correct |
78 |
Correct |
142 ms |
31548 KB |
Output is correct |
79 |
Correct |
156 ms |
31148 KB |
Output is correct |
80 |
Correct |
104 ms |
24924 KB |
Output is correct |
81 |
Correct |
118 ms |
24624 KB |
Output is correct |
82 |
Correct |
9 ms |
8684 KB |
Output is correct |
83 |
Correct |
9 ms |
8812 KB |
Output is correct |
84 |
Correct |
8 ms |
8556 KB |
Output is correct |
85 |
Correct |
8 ms |
8556 KB |
Output is correct |
86 |
Correct |
8 ms |
8556 KB |
Output is correct |
87 |
Correct |
8 ms |
8556 KB |
Output is correct |
88 |
Correct |
8 ms |
8556 KB |
Output is correct |
89 |
Correct |
7 ms |
8556 KB |
Output is correct |
90 |
Correct |
8 ms |
8556 KB |
Output is correct |
91 |
Correct |
8 ms |
8684 KB |
Output is correct |
92 |
Correct |
7 ms |
8684 KB |
Output is correct |
93 |
Correct |
8 ms |
8556 KB |
Output is correct |
94 |
Correct |
8 ms |
8684 KB |
Output is correct |
95 |
Correct |
8 ms |
8556 KB |
Output is correct |
96 |
Correct |
8 ms |
8556 KB |
Output is correct |
97 |
Correct |
8 ms |
8556 KB |
Output is correct |
98 |
Correct |
8 ms |
8556 KB |
Output is correct |
99 |
Correct |
8 ms |
8556 KB |
Output is correct |
100 |
Correct |
7 ms |
8556 KB |
Output is correct |
101 |
Correct |
7 ms |
8556 KB |
Output is correct |
102 |
Correct |
7 ms |
8428 KB |
Output is correct |
103 |
Correct |
6 ms |
8300 KB |
Output is correct |
104 |
Correct |
8 ms |
8428 KB |
Output is correct |
105 |
Correct |
7 ms |
8428 KB |
Output is correct |
106 |
Correct |
7 ms |
8428 KB |
Output is correct |
107 |
Correct |
7 ms |
8428 KB |
Output is correct |
108 |
Correct |
272 ms |
48560 KB |
Output is correct |
109 |
Correct |
275 ms |
49984 KB |
Output is correct |
110 |
Correct |
272 ms |
49840 KB |
Output is correct |
111 |
Correct |
278 ms |
49960 KB |
Output is correct |
112 |
Correct |
257 ms |
49968 KB |
Output is correct |
113 |
Correct |
334 ms |
59568 KB |
Output is correct |
114 |
Correct |
317 ms |
56496 KB |
Output is correct |
115 |
Correct |
293 ms |
55012 KB |
Output is correct |
116 |
Correct |
294 ms |
53552 KB |
Output is correct |
117 |
Correct |
273 ms |
49968 KB |
Output is correct |
118 |
Correct |
283 ms |
49840 KB |
Output is correct |
119 |
Correct |
274 ms |
49840 KB |
Output is correct |
120 |
Correct |
284 ms |
49840 KB |
Output is correct |
121 |
Correct |
251 ms |
48176 KB |
Output is correct |
122 |
Correct |
225 ms |
38704 KB |
Output is correct |
123 |
Correct |
129 ms |
30012 KB |
Output is correct |
124 |
Correct |
183 ms |
41224 KB |
Output is correct |
125 |
Correct |
174 ms |
41260 KB |
Output is correct |
126 |
Correct |
167 ms |
41248 KB |
Output is correct |
127 |
Correct |
190 ms |
41296 KB |
Output is correct |
128 |
Correct |
9 ms |
8480 KB |
Output is correct |
129 |
Correct |
7 ms |
8556 KB |
Output is correct |
130 |
Correct |
7 ms |
8556 KB |
Output is correct |
131 |
Correct |
8 ms |
8428 KB |
Output is correct |
132 |
Correct |
9 ms |
8428 KB |
Output is correct |
133 |
Correct |
7 ms |
8300 KB |
Output is correct |
134 |
Correct |
8 ms |
8300 KB |
Output is correct |
135 |
Correct |
7 ms |
8300 KB |
Output is correct |
136 |
Correct |
8 ms |
8304 KB |
Output is correct |
137 |
Correct |
7 ms |
8300 KB |
Output is correct |
138 |
Correct |
8 ms |
8564 KB |
Output is correct |
139 |
Correct |
8 ms |
8556 KB |
Output is correct |
140 |
Correct |
8 ms |
8556 KB |
Output is correct |
141 |
Correct |
8 ms |
8500 KB |
Output is correct |
142 |
Correct |
8 ms |
8556 KB |
Output is correct |
143 |
Correct |
8 ms |
8428 KB |
Output is correct |
144 |
Correct |
8 ms |
8428 KB |
Output is correct |
145 |
Correct |
8 ms |
8428 KB |
Output is correct |
146 |
Correct |
8 ms |
8352 KB |
Output is correct |
147 |
Correct |
7 ms |
8300 KB |
Output is correct |
148 |
Correct |
8 ms |
8556 KB |
Output is correct |
149 |
Correct |
8 ms |
8556 KB |
Output is correct |
150 |
Correct |
8 ms |
8428 KB |
Output is correct |
151 |
Correct |
8 ms |
8428 KB |
Output is correct |
152 |
Correct |
6 ms |
8172 KB |
Output is correct |
153 |
Correct |
6 ms |
8192 KB |
Output is correct |
154 |
Correct |
6 ms |
8172 KB |
Output is correct |
155 |
Correct |
282 ms |
48560 KB |
Output is correct |
156 |
Correct |
311 ms |
49784 KB |
Output is correct |
157 |
Correct |
330 ms |
48432 KB |
Output is correct |
158 |
Correct |
251 ms |
35128 KB |
Output is correct |
159 |
Correct |
204 ms |
28536 KB |
Output is correct |
160 |
Correct |
199 ms |
25920 KB |
Output is correct |
161 |
Correct |
173 ms |
25280 KB |
Output is correct |
162 |
Correct |
181 ms |
21956 KB |
Output is correct |
163 |
Correct |
168 ms |
21700 KB |
Output is correct |
164 |
Correct |
155 ms |
20164 KB |
Output is correct |
165 |
Correct |
139 ms |
18952 KB |
Output is correct |
166 |
Correct |
138 ms |
18412 KB |
Output is correct |
167 |
Correct |
166 ms |
18540 KB |
Output is correct |
168 |
Correct |
150 ms |
21868 KB |
Output is correct |
169 |
Correct |
310 ms |
55856 KB |
Output is correct |
170 |
Correct |
290 ms |
53680 KB |
Output is correct |
171 |
Correct |
289 ms |
45644 KB |
Output is correct |
172 |
Correct |
287 ms |
43464 KB |
Output is correct |
173 |
Correct |
261 ms |
35128 KB |
Output is correct |
174 |
Correct |
258 ms |
35244 KB |
Output is correct |
175 |
Correct |
249 ms |
35252 KB |
Output is correct |
176 |
Correct |
214 ms |
33340 KB |
Output is correct |
177 |
Correct |
171 ms |
27836 KB |
Output is correct |
178 |
Correct |
240 ms |
40624 KB |
Output is correct |
179 |
Correct |
240 ms |
40680 KB |
Output is correct |
180 |
Correct |
227 ms |
38448 KB |
Output is correct |
181 |
Correct |
247 ms |
38192 KB |
Output is correct |
182 |
Correct |
6 ms |
8172 KB |
Output is correct |
183 |
Correct |
6 ms |
8300 KB |
Output is correct |
184 |
Correct |
7 ms |
8428 KB |
Output is correct |
185 |
Correct |
8 ms |
8428 KB |
Output is correct |
186 |
Correct |
9 ms |
8576 KB |
Output is correct |
187 |
Correct |
7 ms |
8300 KB |
Output is correct |
188 |
Correct |
7 ms |
8428 KB |
Output is correct |
189 |
Correct |
7 ms |
8300 KB |
Output is correct |
190 |
Correct |
7 ms |
8300 KB |
Output is correct |
191 |
Correct |
9 ms |
8260 KB |
Output is correct |
192 |
Correct |
6 ms |
8172 KB |
Output is correct |
193 |
Correct |
7 ms |
8428 KB |
Output is correct |
194 |
Correct |
7 ms |
8428 KB |
Output is correct |
195 |
Correct |
7 ms |
8300 KB |
Output is correct |
196 |
Correct |
7 ms |
8300 KB |
Output is correct |
197 |
Correct |
8 ms |
8428 KB |
Output is correct |
198 |
Correct |
7 ms |
8300 KB |
Output is correct |
199 |
Correct |
7 ms |
8300 KB |
Output is correct |
200 |
Correct |
7 ms |
8428 KB |
Output is correct |
201 |
Correct |
7 ms |
8428 KB |
Output is correct |
202 |
Correct |
7 ms |
8428 KB |
Output is correct |
203 |
Correct |
7 ms |
8300 KB |
Output is correct |
204 |
Correct |
7 ms |
8300 KB |
Output is correct |
205 |
Correct |
7 ms |
8300 KB |
Output is correct |
206 |
Correct |
6 ms |
8300 KB |
Output is correct |
207 |
Correct |
7 ms |
8300 KB |
Output is correct |
208 |
Correct |
7 ms |
8300 KB |
Output is correct |
209 |
Correct |
9 ms |
8556 KB |
Output is correct |
210 |
Correct |
128 ms |
29688 KB |
Output is correct |
211 |
Correct |
193 ms |
31804 KB |
Output is correct |
212 |
Correct |
241 ms |
33472 KB |
Output is correct |
213 |
Correct |
276 ms |
32428 KB |
Output is correct |
214 |
Correct |
143 ms |
27924 KB |
Output is correct |
215 |
Correct |
138 ms |
25920 KB |
Output is correct |
216 |
Correct |
244 ms |
38320 KB |
Output is correct |
217 |
Correct |
232 ms |
29500 KB |
Output is correct |
218 |
Correct |
171 ms |
22060 KB |
Output is correct |
219 |
Correct |
159 ms |
20184 KB |
Output is correct |
220 |
Correct |
140 ms |
18824 KB |
Output is correct |
221 |
Correct |
137 ms |
18156 KB |
Output is correct |
222 |
Correct |
158 ms |
20104 KB |
Output is correct |
223 |
Correct |
279 ms |
37820 KB |
Output is correct |
224 |
Correct |
250 ms |
36412 KB |
Output is correct |
225 |
Correct |
245 ms |
28476 KB |
Output is correct |
226 |
Correct |
208 ms |
28268 KB |
Output is correct |
227 |
Correct |
205 ms |
28220 KB |
Output is correct |
228 |
Correct |
188 ms |
26176 KB |
Output is correct |
229 |
Correct |
153 ms |
23232 KB |
Output is correct |
230 |
Correct |
212 ms |
28696 KB |
Output is correct |
231 |
Correct |
211 ms |
28732 KB |
Output is correct |