#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;
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++;
s.push(u); ///s traces the path of tree traversal
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
do{
assert(!s.empty());
nn = s.top();
s.pop();
biconnected.back().insert(nn);
}while(nn != u);
}
}
else if(v != g[u].parent){
g[u].low = min(g[u].low,g[v].depth); ///g[v].depth not num!!!!!!
}
s.push(u);
}
}
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:24:21: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
for(int i = 0;i < g[u].adj.size();i++){
~~^~~~~~~~~~~~~~~~~
count_triplets.cpp: In function 'void dp(int)':
count_triplets.cpp:70:21: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
for(int i = 0;i < bct[u].adj.size();i++){
~~^~~~~~~~~~~~~~~~~~~
count_triplets.cpp: In function 'int main()':
count_triplets.cpp:113:21: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
for(int i = 0;i < biconnected.size();i++){
~~^~~~~~~~~~~~~~~~~~~~
count_triplets.cpp:126:21: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
for(int i = 0;i < bct.size();i++){
~~^~~~~~~~~~~~
count_triplets.cpp:132:21: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
for(int i = 0;i < bct.size();i++){
~~^~~~~~~~~~~~
count_triplets.cpp:136:25: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
for(int j = 0;j < bct[i].adj.size();j++){
~~^~~~~~~~~~~~~~~~~~~
count_triplets.cpp:146:25: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
for(int j = 0;j < branches.size();j++) total += branches[j];
~~^~~~~~~~~~~~~~~~~
count_triplets.cpp:149:25: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
for(int j = 0;j < branches.size();j++){
~~^~~~~~~~~~~~~~~~~
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
9 ms |
8192 KB |
Output is correct |
2 |
Correct |
9 ms |
8192 KB |
Output is correct |
3 |
Correct |
8 ms |
8192 KB |
Output is correct |
4 |
Correct |
8 ms |
8192 KB |
Output is correct |
5 |
Correct |
8 ms |
8192 KB |
Output is correct |
6 |
Correct |
8 ms |
8192 KB |
Output is correct |
7 |
Correct |
10 ms |
8192 KB |
Output is correct |
8 |
Correct |
11 ms |
8192 KB |
Output is correct |
9 |
Correct |
8 ms |
8192 KB |
Output is correct |
10 |
Correct |
15 ms |
8192 KB |
Output is correct |
11 |
Correct |
11 ms |
8192 KB |
Output is correct |
12 |
Correct |
9 ms |
8192 KB |
Output is correct |
13 |
Correct |
13 ms |
8160 KB |
Output is correct |
14 |
Correct |
10 ms |
8164 KB |
Output is correct |
15 |
Correct |
10 ms |
8192 KB |
Output is correct |
16 |
Correct |
10 ms |
8192 KB |
Output is correct |
17 |
Correct |
10 ms |
8192 KB |
Output is correct |
18 |
Correct |
10 ms |
8192 KB |
Output is correct |
19 |
Correct |
13 ms |
8140 KB |
Output is correct |
20 |
Correct |
12 ms |
8164 KB |
Output is correct |
21 |
Correct |
11 ms |
8192 KB |
Output is correct |
22 |
Correct |
12 ms |
8192 KB |
Output is correct |
23 |
Correct |
8 ms |
8164 KB |
Output is correct |
24 |
Correct |
12 ms |
8164 KB |
Output is correct |
25 |
Correct |
15 ms |
8192 KB |
Output is correct |
26 |
Correct |
10 ms |
8164 KB |
Output is correct |
27 |
Correct |
17 ms |
8192 KB |
Output is correct |
28 |
Correct |
10 ms |
8192 KB |
Output is correct |
29 |
Correct |
9 ms |
8192 KB |
Output is correct |
30 |
Correct |
11 ms |
8192 KB |
Output is correct |
31 |
Correct |
9 ms |
8192 KB |
Output is correct |
32 |
Correct |
10 ms |
8192 KB |
Output is correct |
33 |
Correct |
11 ms |
8192 KB |
Output is correct |
34 |
Correct |
9 ms |
8192 KB |
Output is correct |
35 |
Correct |
9 ms |
8192 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
9 ms |
8192 KB |
Output is correct |
2 |
Correct |
9 ms |
8192 KB |
Output is correct |
3 |
Correct |
8 ms |
8192 KB |
Output is correct |
4 |
Correct |
8 ms |
8192 KB |
Output is correct |
5 |
Correct |
8 ms |
8192 KB |
Output is correct |
6 |
Correct |
8 ms |
8192 KB |
Output is correct |
7 |
Correct |
10 ms |
8192 KB |
Output is correct |
8 |
Correct |
11 ms |
8192 KB |
Output is correct |
9 |
Correct |
8 ms |
8192 KB |
Output is correct |
10 |
Correct |
15 ms |
8192 KB |
Output is correct |
11 |
Correct |
11 ms |
8192 KB |
Output is correct |
12 |
Correct |
9 ms |
8192 KB |
Output is correct |
13 |
Correct |
13 ms |
8160 KB |
Output is correct |
14 |
Correct |
10 ms |
8164 KB |
Output is correct |
15 |
Correct |
10 ms |
8192 KB |
Output is correct |
16 |
Correct |
10 ms |
8192 KB |
Output is correct |
17 |
Correct |
10 ms |
8192 KB |
Output is correct |
18 |
Correct |
10 ms |
8192 KB |
Output is correct |
19 |
Correct |
13 ms |
8140 KB |
Output is correct |
20 |
Correct |
12 ms |
8164 KB |
Output is correct |
21 |
Correct |
11 ms |
8192 KB |
Output is correct |
22 |
Correct |
12 ms |
8192 KB |
Output is correct |
23 |
Correct |
8 ms |
8164 KB |
Output is correct |
24 |
Correct |
12 ms |
8164 KB |
Output is correct |
25 |
Correct |
15 ms |
8192 KB |
Output is correct |
26 |
Correct |
10 ms |
8164 KB |
Output is correct |
27 |
Correct |
17 ms |
8192 KB |
Output is correct |
28 |
Correct |
10 ms |
8192 KB |
Output is correct |
29 |
Correct |
9 ms |
8192 KB |
Output is correct |
30 |
Correct |
11 ms |
8192 KB |
Output is correct |
31 |
Correct |
9 ms |
8192 KB |
Output is correct |
32 |
Correct |
10 ms |
8192 KB |
Output is correct |
33 |
Correct |
11 ms |
8192 KB |
Output is correct |
34 |
Correct |
9 ms |
8192 KB |
Output is correct |
35 |
Correct |
9 ms |
8192 KB |
Output is correct |
36 |
Correct |
9 ms |
8192 KB |
Output is correct |
37 |
Correct |
11 ms |
8192 KB |
Output is correct |
38 |
Correct |
9 ms |
8192 KB |
Output is correct |
39 |
Correct |
9 ms |
8192 KB |
Output is correct |
40 |
Correct |
10 ms |
8192 KB |
Output is correct |
41 |
Correct |
10 ms |
8192 KB |
Output is correct |
42 |
Correct |
10 ms |
8192 KB |
Output is correct |
43 |
Correct |
16 ms |
8192 KB |
Output is correct |
44 |
Correct |
11 ms |
8200 KB |
Output is correct |
45 |
Correct |
10 ms |
8192 KB |
Output is correct |
46 |
Correct |
11 ms |
8192 KB |
Output is correct |
47 |
Correct |
10 ms |
8192 KB |
Output is correct |
48 |
Correct |
11 ms |
8192 KB |
Output is correct |
49 |
Correct |
10 ms |
8192 KB |
Output is correct |
50 |
Correct |
10 ms |
8192 KB |
Output is correct |
51 |
Correct |
10 ms |
8192 KB |
Output is correct |
52 |
Correct |
9 ms |
8192 KB |
Output is correct |
53 |
Correct |
10 ms |
8192 KB |
Output is correct |
54 |
Correct |
11 ms |
8192 KB |
Output is correct |
55 |
Correct |
9 ms |
8192 KB |
Output is correct |
56 |
Correct |
12 ms |
8192 KB |
Output is correct |
57 |
Correct |
10 ms |
8192 KB |
Output is correct |
58 |
Correct |
13 ms |
8212 KB |
Output is correct |
59 |
Correct |
8 ms |
8192 KB |
Output is correct |
60 |
Correct |
10 ms |
8192 KB |
Output is correct |
61 |
Correct |
10 ms |
8192 KB |
Output is correct |
62 |
Correct |
11 ms |
8192 KB |
Output is correct |
63 |
Correct |
10 ms |
8192 KB |
Output is correct |
64 |
Correct |
11 ms |
8192 KB |
Output is correct |
65 |
Correct |
10 ms |
8192 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
216 ms |
32748 KB |
Output is correct |
2 |
Correct |
211 ms |
32768 KB |
Output is correct |
3 |
Correct |
341 ms |
40504 KB |
Output is correct |
4 |
Correct |
272 ms |
36760 KB |
Output is correct |
5 |
Correct |
269 ms |
36344 KB |
Output is correct |
6 |
Correct |
348 ms |
39916 KB |
Output is correct |
7 |
Correct |
401 ms |
39272 KB |
Output is correct |
8 |
Correct |
369 ms |
40652 KB |
Output is correct |
9 |
Correct |
373 ms |
37728 KB |
Output is correct |
10 |
Correct |
418 ms |
35904 KB |
Output is correct |
11 |
Correct |
230 ms |
31788 KB |
Output is correct |
12 |
Correct |
224 ms |
31552 KB |
Output is correct |
13 |
Correct |
207 ms |
31100 KB |
Output is correct |
14 |
Correct |
202 ms |
30744 KB |
Output is correct |
15 |
Correct |
187 ms |
24744 KB |
Output is correct |
16 |
Correct |
201 ms |
24232 KB |
Output is correct |
17 |
Correct |
10 ms |
8192 KB |
Output is correct |
18 |
Correct |
9 ms |
8192 KB |
Output is correct |
19 |
Correct |
9 ms |
8192 KB |
Output is correct |
20 |
Correct |
12 ms |
8192 KB |
Output is correct |
21 |
Correct |
9 ms |
8192 KB |
Output is correct |
22 |
Correct |
10 ms |
8192 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
11 ms |
8576 KB |
Output is correct |
2 |
Correct |
11 ms |
8448 KB |
Output is correct |
3 |
Correct |
10 ms |
8576 KB |
Output is correct |
4 |
Correct |
10 ms |
8704 KB |
Output is correct |
5 |
Correct |
10 ms |
8576 KB |
Output is correct |
6 |
Correct |
11 ms |
8576 KB |
Output is correct |
7 |
Correct |
11 ms |
8576 KB |
Output is correct |
8 |
Correct |
10 ms |
8576 KB |
Output is correct |
9 |
Correct |
11 ms |
8576 KB |
Output is correct |
10 |
Correct |
11 ms |
8576 KB |
Output is correct |
11 |
Correct |
11 ms |
8572 KB |
Output is correct |
12 |
Correct |
11 ms |
8576 KB |
Output is correct |
13 |
Correct |
11 ms |
8576 KB |
Output is correct |
14 |
Correct |
10 ms |
8448 KB |
Output is correct |
15 |
Correct |
10 ms |
8448 KB |
Output is correct |
16 |
Correct |
18 ms |
8320 KB |
Output is correct |
17 |
Correct |
11 ms |
8448 KB |
Output is correct |
18 |
Correct |
11 ms |
8448 KB |
Output is correct |
19 |
Correct |
12 ms |
8448 KB |
Output is correct |
20 |
Correct |
12 ms |
8448 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
390 ms |
48928 KB |
Output is correct |
2 |
Correct |
366 ms |
49056 KB |
Output is correct |
3 |
Correct |
452 ms |
48952 KB |
Output is correct |
4 |
Correct |
384 ms |
49024 KB |
Output is correct |
5 |
Correct |
416 ms |
49036 KB |
Output is correct |
6 |
Correct |
538 ms |
57400 KB |
Output is correct |
7 |
Correct |
412 ms |
54512 KB |
Output is correct |
8 |
Correct |
443 ms |
53116 KB |
Output is correct |
9 |
Correct |
460 ms |
51768 KB |
Output is correct |
10 |
Correct |
387 ms |
48952 KB |
Output is correct |
11 |
Correct |
407 ms |
48952 KB |
Output is correct |
12 |
Correct |
472 ms |
49080 KB |
Output is correct |
13 |
Correct |
414 ms |
49080 KB |
Output is correct |
14 |
Correct |
453 ms |
47532 KB |
Output is correct |
15 |
Correct |
409 ms |
38160 KB |
Output is correct |
16 |
Correct |
237 ms |
29640 KB |
Output is correct |
17 |
Correct |
250 ms |
40852 KB |
Output is correct |
18 |
Correct |
255 ms |
40664 KB |
Output is correct |
19 |
Correct |
245 ms |
40632 KB |
Output is correct |
20 |
Correct |
264 ms |
40632 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
15 ms |
8572 KB |
Output is correct |
2 |
Correct |
14 ms |
8548 KB |
Output is correct |
3 |
Correct |
12 ms |
8548 KB |
Output is correct |
4 |
Correct |
11 ms |
8448 KB |
Output is correct |
5 |
Correct |
12 ms |
8320 KB |
Output is correct |
6 |
Correct |
11 ms |
8320 KB |
Output is correct |
7 |
Correct |
10 ms |
8320 KB |
Output is correct |
8 |
Correct |
16 ms |
8320 KB |
Output is correct |
9 |
Correct |
13 ms |
8320 KB |
Output is correct |
10 |
Correct |
10 ms |
8320 KB |
Output is correct |
11 |
Correct |
10 ms |
8320 KB |
Output is correct |
12 |
Correct |
10 ms |
8576 KB |
Output is correct |
13 |
Correct |
12 ms |
8576 KB |
Output is correct |
14 |
Correct |
11 ms |
8576 KB |
Output is correct |
15 |
Correct |
11 ms |
8576 KB |
Output is correct |
16 |
Correct |
11 ms |
8448 KB |
Output is correct |
17 |
Correct |
14 ms |
8448 KB |
Output is correct |
18 |
Correct |
10 ms |
8448 KB |
Output is correct |
19 |
Correct |
10 ms |
8320 KB |
Output is correct |
20 |
Correct |
11 ms |
8320 KB |
Output is correct |
21 |
Correct |
11 ms |
8576 KB |
Output is correct |
22 |
Correct |
14 ms |
8448 KB |
Output is correct |
23 |
Correct |
11 ms |
8448 KB |
Output is correct |
24 |
Correct |
10 ms |
8448 KB |
Output is correct |
25 |
Correct |
9 ms |
8164 KB |
Output is correct |
26 |
Correct |
15 ms |
8236 KB |
Output is correct |
27 |
Correct |
9 ms |
8192 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
394 ms |
49028 KB |
Output is correct |
2 |
Correct |
394 ms |
48896 KB |
Output is correct |
3 |
Correct |
417 ms |
47544 KB |
Output is correct |
4 |
Correct |
386 ms |
34488 KB |
Output is correct |
5 |
Correct |
325 ms |
27968 KB |
Output is correct |
6 |
Correct |
276 ms |
25032 KB |
Output is correct |
7 |
Correct |
303 ms |
24520 KB |
Output is correct |
8 |
Correct |
281 ms |
21196 KB |
Output is correct |
9 |
Correct |
256 ms |
20688 KB |
Output is correct |
10 |
Correct |
287 ms |
19452 KB |
Output is correct |
11 |
Correct |
237 ms |
18460 KB |
Output is correct |
12 |
Correct |
223 ms |
17784 KB |
Output is correct |
13 |
Correct |
225 ms |
17892 KB |
Output is correct |
14 |
Correct |
221 ms |
21264 KB |
Output is correct |
15 |
Correct |
475 ms |
54112 KB |
Output is correct |
16 |
Correct |
512 ms |
51996 KB |
Output is correct |
17 |
Correct |
455 ms |
44988 KB |
Output is correct |
18 |
Correct |
435 ms |
42756 KB |
Output is correct |
19 |
Correct |
387 ms |
34452 KB |
Output is correct |
20 |
Correct |
422 ms |
34524 KB |
Output is correct |
21 |
Correct |
398 ms |
34412 KB |
Output is correct |
22 |
Correct |
331 ms |
32804 KB |
Output is correct |
23 |
Correct |
263 ms |
27552 KB |
Output is correct |
24 |
Correct |
348 ms |
40036 KB |
Output is correct |
25 |
Correct |
395 ms |
40188 KB |
Output is correct |
26 |
Correct |
364 ms |
37832 KB |
Output is correct |
27 |
Correct |
383 ms |
37648 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
9 ms |
8192 KB |
Output is correct |
2 |
Correct |
9 ms |
8192 KB |
Output is correct |
3 |
Correct |
8 ms |
8192 KB |
Output is correct |
4 |
Correct |
8 ms |
8192 KB |
Output is correct |
5 |
Correct |
8 ms |
8192 KB |
Output is correct |
6 |
Correct |
8 ms |
8192 KB |
Output is correct |
7 |
Correct |
10 ms |
8192 KB |
Output is correct |
8 |
Correct |
11 ms |
8192 KB |
Output is correct |
9 |
Correct |
8 ms |
8192 KB |
Output is correct |
10 |
Correct |
15 ms |
8192 KB |
Output is correct |
11 |
Correct |
11 ms |
8192 KB |
Output is correct |
12 |
Correct |
9 ms |
8192 KB |
Output is correct |
13 |
Correct |
13 ms |
8160 KB |
Output is correct |
14 |
Correct |
10 ms |
8164 KB |
Output is correct |
15 |
Correct |
10 ms |
8192 KB |
Output is correct |
16 |
Correct |
10 ms |
8192 KB |
Output is correct |
17 |
Correct |
10 ms |
8192 KB |
Output is correct |
18 |
Correct |
10 ms |
8192 KB |
Output is correct |
19 |
Correct |
13 ms |
8140 KB |
Output is correct |
20 |
Correct |
12 ms |
8164 KB |
Output is correct |
21 |
Correct |
11 ms |
8192 KB |
Output is correct |
22 |
Correct |
12 ms |
8192 KB |
Output is correct |
23 |
Correct |
8 ms |
8164 KB |
Output is correct |
24 |
Correct |
12 ms |
8164 KB |
Output is correct |
25 |
Correct |
15 ms |
8192 KB |
Output is correct |
26 |
Correct |
10 ms |
8164 KB |
Output is correct |
27 |
Correct |
17 ms |
8192 KB |
Output is correct |
28 |
Correct |
10 ms |
8192 KB |
Output is correct |
29 |
Correct |
9 ms |
8192 KB |
Output is correct |
30 |
Correct |
11 ms |
8192 KB |
Output is correct |
31 |
Correct |
9 ms |
8192 KB |
Output is correct |
32 |
Correct |
10 ms |
8192 KB |
Output is correct |
33 |
Correct |
11 ms |
8192 KB |
Output is correct |
34 |
Correct |
9 ms |
8192 KB |
Output is correct |
35 |
Correct |
9 ms |
8192 KB |
Output is correct |
36 |
Correct |
9 ms |
8192 KB |
Output is correct |
37 |
Correct |
11 ms |
8192 KB |
Output is correct |
38 |
Correct |
9 ms |
8192 KB |
Output is correct |
39 |
Correct |
9 ms |
8192 KB |
Output is correct |
40 |
Correct |
10 ms |
8192 KB |
Output is correct |
41 |
Correct |
10 ms |
8192 KB |
Output is correct |
42 |
Correct |
10 ms |
8192 KB |
Output is correct |
43 |
Correct |
16 ms |
8192 KB |
Output is correct |
44 |
Correct |
11 ms |
8200 KB |
Output is correct |
45 |
Correct |
10 ms |
8192 KB |
Output is correct |
46 |
Correct |
11 ms |
8192 KB |
Output is correct |
47 |
Correct |
10 ms |
8192 KB |
Output is correct |
48 |
Correct |
11 ms |
8192 KB |
Output is correct |
49 |
Correct |
10 ms |
8192 KB |
Output is correct |
50 |
Correct |
10 ms |
8192 KB |
Output is correct |
51 |
Correct |
10 ms |
8192 KB |
Output is correct |
52 |
Correct |
9 ms |
8192 KB |
Output is correct |
53 |
Correct |
10 ms |
8192 KB |
Output is correct |
54 |
Correct |
11 ms |
8192 KB |
Output is correct |
55 |
Correct |
9 ms |
8192 KB |
Output is correct |
56 |
Correct |
12 ms |
8192 KB |
Output is correct |
57 |
Correct |
10 ms |
8192 KB |
Output is correct |
58 |
Correct |
13 ms |
8212 KB |
Output is correct |
59 |
Correct |
8 ms |
8192 KB |
Output is correct |
60 |
Correct |
10 ms |
8192 KB |
Output is correct |
61 |
Correct |
10 ms |
8192 KB |
Output is correct |
62 |
Correct |
11 ms |
8192 KB |
Output is correct |
63 |
Correct |
10 ms |
8192 KB |
Output is correct |
64 |
Correct |
11 ms |
8192 KB |
Output is correct |
65 |
Correct |
10 ms |
8192 KB |
Output is correct |
66 |
Correct |
10 ms |
8192 KB |
Output is correct |
67 |
Correct |
11 ms |
8320 KB |
Output is correct |
68 |
Correct |
11 ms |
8448 KB |
Output is correct |
69 |
Correct |
10 ms |
8320 KB |
Output is correct |
70 |
Correct |
11 ms |
8364 KB |
Output is correct |
71 |
Correct |
11 ms |
8320 KB |
Output is correct |
72 |
Correct |
12 ms |
8448 KB |
Output is correct |
73 |
Correct |
11 ms |
8320 KB |
Output is correct |
74 |
Correct |
11 ms |
8420 KB |
Output is correct |
75 |
Correct |
12 ms |
8320 KB |
Output is correct |
76 |
Correct |
11 ms |
8192 KB |
Output is correct |
77 |
Correct |
11 ms |
8448 KB |
Output is correct |
78 |
Correct |
12 ms |
8448 KB |
Output is correct |
79 |
Correct |
10 ms |
8224 KB |
Output is correct |
80 |
Correct |
10 ms |
8192 KB |
Output is correct |
81 |
Correct |
10 ms |
8320 KB |
Output is correct |
82 |
Correct |
10 ms |
8320 KB |
Output is correct |
83 |
Correct |
10 ms |
8320 KB |
Output is correct |
84 |
Correct |
10 ms |
8436 KB |
Output is correct |
85 |
Correct |
9 ms |
8448 KB |
Output is correct |
86 |
Correct |
10 ms |
8360 KB |
Output is correct |
87 |
Correct |
11 ms |
8336 KB |
Output is correct |
88 |
Correct |
13 ms |
8320 KB |
Output is correct |
89 |
Correct |
11 ms |
8320 KB |
Output is correct |
90 |
Correct |
10 ms |
8320 KB |
Output is correct |
91 |
Correct |
11 ms |
8320 KB |
Output is correct |
92 |
Correct |
15 ms |
8320 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
9 ms |
8192 KB |
Output is correct |
2 |
Correct |
9 ms |
8192 KB |
Output is correct |
3 |
Correct |
8 ms |
8192 KB |
Output is correct |
4 |
Correct |
8 ms |
8192 KB |
Output is correct |
5 |
Correct |
8 ms |
8192 KB |
Output is correct |
6 |
Correct |
8 ms |
8192 KB |
Output is correct |
7 |
Correct |
10 ms |
8192 KB |
Output is correct |
8 |
Correct |
11 ms |
8192 KB |
Output is correct |
9 |
Correct |
8 ms |
8192 KB |
Output is correct |
10 |
Correct |
15 ms |
8192 KB |
Output is correct |
11 |
Correct |
11 ms |
8192 KB |
Output is correct |
12 |
Correct |
9 ms |
8192 KB |
Output is correct |
13 |
Correct |
13 ms |
8160 KB |
Output is correct |
14 |
Correct |
10 ms |
8164 KB |
Output is correct |
15 |
Correct |
10 ms |
8192 KB |
Output is correct |
16 |
Correct |
10 ms |
8192 KB |
Output is correct |
17 |
Correct |
10 ms |
8192 KB |
Output is correct |
18 |
Correct |
10 ms |
8192 KB |
Output is correct |
19 |
Correct |
13 ms |
8140 KB |
Output is correct |
20 |
Correct |
12 ms |
8164 KB |
Output is correct |
21 |
Correct |
11 ms |
8192 KB |
Output is correct |
22 |
Correct |
12 ms |
8192 KB |
Output is correct |
23 |
Correct |
8 ms |
8164 KB |
Output is correct |
24 |
Correct |
12 ms |
8164 KB |
Output is correct |
25 |
Correct |
15 ms |
8192 KB |
Output is correct |
26 |
Correct |
10 ms |
8164 KB |
Output is correct |
27 |
Correct |
17 ms |
8192 KB |
Output is correct |
28 |
Correct |
10 ms |
8192 KB |
Output is correct |
29 |
Correct |
9 ms |
8192 KB |
Output is correct |
30 |
Correct |
11 ms |
8192 KB |
Output is correct |
31 |
Correct |
9 ms |
8192 KB |
Output is correct |
32 |
Correct |
10 ms |
8192 KB |
Output is correct |
33 |
Correct |
11 ms |
8192 KB |
Output is correct |
34 |
Correct |
9 ms |
8192 KB |
Output is correct |
35 |
Correct |
9 ms |
8192 KB |
Output is correct |
36 |
Correct |
9 ms |
8192 KB |
Output is correct |
37 |
Correct |
11 ms |
8192 KB |
Output is correct |
38 |
Correct |
9 ms |
8192 KB |
Output is correct |
39 |
Correct |
9 ms |
8192 KB |
Output is correct |
40 |
Correct |
10 ms |
8192 KB |
Output is correct |
41 |
Correct |
10 ms |
8192 KB |
Output is correct |
42 |
Correct |
10 ms |
8192 KB |
Output is correct |
43 |
Correct |
16 ms |
8192 KB |
Output is correct |
44 |
Correct |
11 ms |
8200 KB |
Output is correct |
45 |
Correct |
10 ms |
8192 KB |
Output is correct |
46 |
Correct |
11 ms |
8192 KB |
Output is correct |
47 |
Correct |
10 ms |
8192 KB |
Output is correct |
48 |
Correct |
11 ms |
8192 KB |
Output is correct |
49 |
Correct |
10 ms |
8192 KB |
Output is correct |
50 |
Correct |
10 ms |
8192 KB |
Output is correct |
51 |
Correct |
10 ms |
8192 KB |
Output is correct |
52 |
Correct |
9 ms |
8192 KB |
Output is correct |
53 |
Correct |
10 ms |
8192 KB |
Output is correct |
54 |
Correct |
11 ms |
8192 KB |
Output is correct |
55 |
Correct |
9 ms |
8192 KB |
Output is correct |
56 |
Correct |
12 ms |
8192 KB |
Output is correct |
57 |
Correct |
10 ms |
8192 KB |
Output is correct |
58 |
Correct |
13 ms |
8212 KB |
Output is correct |
59 |
Correct |
8 ms |
8192 KB |
Output is correct |
60 |
Correct |
10 ms |
8192 KB |
Output is correct |
61 |
Correct |
10 ms |
8192 KB |
Output is correct |
62 |
Correct |
11 ms |
8192 KB |
Output is correct |
63 |
Correct |
10 ms |
8192 KB |
Output is correct |
64 |
Correct |
11 ms |
8192 KB |
Output is correct |
65 |
Correct |
10 ms |
8192 KB |
Output is correct |
66 |
Correct |
216 ms |
32748 KB |
Output is correct |
67 |
Correct |
211 ms |
32768 KB |
Output is correct |
68 |
Correct |
341 ms |
40504 KB |
Output is correct |
69 |
Correct |
272 ms |
36760 KB |
Output is correct |
70 |
Correct |
269 ms |
36344 KB |
Output is correct |
71 |
Correct |
348 ms |
39916 KB |
Output is correct |
72 |
Correct |
401 ms |
39272 KB |
Output is correct |
73 |
Correct |
369 ms |
40652 KB |
Output is correct |
74 |
Correct |
373 ms |
37728 KB |
Output is correct |
75 |
Correct |
418 ms |
35904 KB |
Output is correct |
76 |
Correct |
230 ms |
31788 KB |
Output is correct |
77 |
Correct |
224 ms |
31552 KB |
Output is correct |
78 |
Correct |
207 ms |
31100 KB |
Output is correct |
79 |
Correct |
202 ms |
30744 KB |
Output is correct |
80 |
Correct |
187 ms |
24744 KB |
Output is correct |
81 |
Correct |
201 ms |
24232 KB |
Output is correct |
82 |
Correct |
10 ms |
8192 KB |
Output is correct |
83 |
Correct |
9 ms |
8192 KB |
Output is correct |
84 |
Correct |
9 ms |
8192 KB |
Output is correct |
85 |
Correct |
12 ms |
8192 KB |
Output is correct |
86 |
Correct |
9 ms |
8192 KB |
Output is correct |
87 |
Correct |
10 ms |
8192 KB |
Output is correct |
88 |
Correct |
11 ms |
8576 KB |
Output is correct |
89 |
Correct |
11 ms |
8448 KB |
Output is correct |
90 |
Correct |
10 ms |
8576 KB |
Output is correct |
91 |
Correct |
10 ms |
8704 KB |
Output is correct |
92 |
Correct |
10 ms |
8576 KB |
Output is correct |
93 |
Correct |
11 ms |
8576 KB |
Output is correct |
94 |
Correct |
11 ms |
8576 KB |
Output is correct |
95 |
Correct |
10 ms |
8576 KB |
Output is correct |
96 |
Correct |
11 ms |
8576 KB |
Output is correct |
97 |
Correct |
11 ms |
8576 KB |
Output is correct |
98 |
Correct |
11 ms |
8572 KB |
Output is correct |
99 |
Correct |
11 ms |
8576 KB |
Output is correct |
100 |
Correct |
11 ms |
8576 KB |
Output is correct |
101 |
Correct |
10 ms |
8448 KB |
Output is correct |
102 |
Correct |
10 ms |
8448 KB |
Output is correct |
103 |
Correct |
18 ms |
8320 KB |
Output is correct |
104 |
Correct |
11 ms |
8448 KB |
Output is correct |
105 |
Correct |
11 ms |
8448 KB |
Output is correct |
106 |
Correct |
12 ms |
8448 KB |
Output is correct |
107 |
Correct |
12 ms |
8448 KB |
Output is correct |
108 |
Correct |
390 ms |
48928 KB |
Output is correct |
109 |
Correct |
366 ms |
49056 KB |
Output is correct |
110 |
Correct |
452 ms |
48952 KB |
Output is correct |
111 |
Correct |
384 ms |
49024 KB |
Output is correct |
112 |
Correct |
416 ms |
49036 KB |
Output is correct |
113 |
Correct |
538 ms |
57400 KB |
Output is correct |
114 |
Correct |
412 ms |
54512 KB |
Output is correct |
115 |
Correct |
443 ms |
53116 KB |
Output is correct |
116 |
Correct |
460 ms |
51768 KB |
Output is correct |
117 |
Correct |
387 ms |
48952 KB |
Output is correct |
118 |
Correct |
407 ms |
48952 KB |
Output is correct |
119 |
Correct |
472 ms |
49080 KB |
Output is correct |
120 |
Correct |
414 ms |
49080 KB |
Output is correct |
121 |
Correct |
453 ms |
47532 KB |
Output is correct |
122 |
Correct |
409 ms |
38160 KB |
Output is correct |
123 |
Correct |
237 ms |
29640 KB |
Output is correct |
124 |
Correct |
250 ms |
40852 KB |
Output is correct |
125 |
Correct |
255 ms |
40664 KB |
Output is correct |
126 |
Correct |
245 ms |
40632 KB |
Output is correct |
127 |
Correct |
264 ms |
40632 KB |
Output is correct |
128 |
Correct |
15 ms |
8572 KB |
Output is correct |
129 |
Correct |
14 ms |
8548 KB |
Output is correct |
130 |
Correct |
12 ms |
8548 KB |
Output is correct |
131 |
Correct |
11 ms |
8448 KB |
Output is correct |
132 |
Correct |
12 ms |
8320 KB |
Output is correct |
133 |
Correct |
11 ms |
8320 KB |
Output is correct |
134 |
Correct |
10 ms |
8320 KB |
Output is correct |
135 |
Correct |
16 ms |
8320 KB |
Output is correct |
136 |
Correct |
13 ms |
8320 KB |
Output is correct |
137 |
Correct |
10 ms |
8320 KB |
Output is correct |
138 |
Correct |
10 ms |
8320 KB |
Output is correct |
139 |
Correct |
10 ms |
8576 KB |
Output is correct |
140 |
Correct |
12 ms |
8576 KB |
Output is correct |
141 |
Correct |
11 ms |
8576 KB |
Output is correct |
142 |
Correct |
11 ms |
8576 KB |
Output is correct |
143 |
Correct |
11 ms |
8448 KB |
Output is correct |
144 |
Correct |
14 ms |
8448 KB |
Output is correct |
145 |
Correct |
10 ms |
8448 KB |
Output is correct |
146 |
Correct |
10 ms |
8320 KB |
Output is correct |
147 |
Correct |
11 ms |
8320 KB |
Output is correct |
148 |
Correct |
11 ms |
8576 KB |
Output is correct |
149 |
Correct |
14 ms |
8448 KB |
Output is correct |
150 |
Correct |
11 ms |
8448 KB |
Output is correct |
151 |
Correct |
10 ms |
8448 KB |
Output is correct |
152 |
Correct |
9 ms |
8164 KB |
Output is correct |
153 |
Correct |
15 ms |
8236 KB |
Output is correct |
154 |
Correct |
9 ms |
8192 KB |
Output is correct |
155 |
Correct |
394 ms |
49028 KB |
Output is correct |
156 |
Correct |
394 ms |
48896 KB |
Output is correct |
157 |
Correct |
417 ms |
47544 KB |
Output is correct |
158 |
Correct |
386 ms |
34488 KB |
Output is correct |
159 |
Correct |
325 ms |
27968 KB |
Output is correct |
160 |
Correct |
276 ms |
25032 KB |
Output is correct |
161 |
Correct |
303 ms |
24520 KB |
Output is correct |
162 |
Correct |
281 ms |
21196 KB |
Output is correct |
163 |
Correct |
256 ms |
20688 KB |
Output is correct |
164 |
Correct |
287 ms |
19452 KB |
Output is correct |
165 |
Correct |
237 ms |
18460 KB |
Output is correct |
166 |
Correct |
223 ms |
17784 KB |
Output is correct |
167 |
Correct |
225 ms |
17892 KB |
Output is correct |
168 |
Correct |
221 ms |
21264 KB |
Output is correct |
169 |
Correct |
475 ms |
54112 KB |
Output is correct |
170 |
Correct |
512 ms |
51996 KB |
Output is correct |
171 |
Correct |
455 ms |
44988 KB |
Output is correct |
172 |
Correct |
435 ms |
42756 KB |
Output is correct |
173 |
Correct |
387 ms |
34452 KB |
Output is correct |
174 |
Correct |
422 ms |
34524 KB |
Output is correct |
175 |
Correct |
398 ms |
34412 KB |
Output is correct |
176 |
Correct |
331 ms |
32804 KB |
Output is correct |
177 |
Correct |
263 ms |
27552 KB |
Output is correct |
178 |
Correct |
348 ms |
40036 KB |
Output is correct |
179 |
Correct |
395 ms |
40188 KB |
Output is correct |
180 |
Correct |
364 ms |
37832 KB |
Output is correct |
181 |
Correct |
383 ms |
37648 KB |
Output is correct |
182 |
Correct |
10 ms |
8192 KB |
Output is correct |
183 |
Correct |
11 ms |
8320 KB |
Output is correct |
184 |
Correct |
11 ms |
8448 KB |
Output is correct |
185 |
Correct |
10 ms |
8320 KB |
Output is correct |
186 |
Correct |
11 ms |
8364 KB |
Output is correct |
187 |
Correct |
11 ms |
8320 KB |
Output is correct |
188 |
Correct |
12 ms |
8448 KB |
Output is correct |
189 |
Correct |
11 ms |
8320 KB |
Output is correct |
190 |
Correct |
11 ms |
8420 KB |
Output is correct |
191 |
Correct |
12 ms |
8320 KB |
Output is correct |
192 |
Correct |
11 ms |
8192 KB |
Output is correct |
193 |
Correct |
11 ms |
8448 KB |
Output is correct |
194 |
Correct |
12 ms |
8448 KB |
Output is correct |
195 |
Correct |
10 ms |
8224 KB |
Output is correct |
196 |
Correct |
10 ms |
8192 KB |
Output is correct |
197 |
Correct |
10 ms |
8320 KB |
Output is correct |
198 |
Correct |
10 ms |
8320 KB |
Output is correct |
199 |
Correct |
10 ms |
8320 KB |
Output is correct |
200 |
Correct |
10 ms |
8436 KB |
Output is correct |
201 |
Correct |
9 ms |
8448 KB |
Output is correct |
202 |
Correct |
10 ms |
8360 KB |
Output is correct |
203 |
Correct |
11 ms |
8336 KB |
Output is correct |
204 |
Correct |
13 ms |
8320 KB |
Output is correct |
205 |
Correct |
11 ms |
8320 KB |
Output is correct |
206 |
Correct |
10 ms |
8320 KB |
Output is correct |
207 |
Correct |
11 ms |
8320 KB |
Output is correct |
208 |
Correct |
15 ms |
8320 KB |
Output is correct |
209 |
Correct |
10 ms |
8144 KB |
Output is correct |
210 |
Correct |
281 ms |
29412 KB |
Output is correct |
211 |
Correct |
286 ms |
30996 KB |
Output is correct |
212 |
Correct |
331 ms |
32136 KB |
Output is correct |
213 |
Correct |
318 ms |
30256 KB |
Output is correct |
214 |
Correct |
169 ms |
27036 KB |
Output is correct |
215 |
Correct |
173 ms |
24880 KB |
Output is correct |
216 |
Correct |
409 ms |
37628 KB |
Output is correct |
217 |
Correct |
377 ms |
28960 KB |
Output is correct |
218 |
Correct |
230 ms |
21244 KB |
Output is correct |
219 |
Correct |
228 ms |
19220 KB |
Output is correct |
220 |
Correct |
225 ms |
18444 KB |
Output is correct |
221 |
Correct |
219 ms |
17528 KB |
Output is correct |
222 |
Correct |
248 ms |
19428 KB |
Output is correct |
223 |
Correct |
443 ms |
37188 KB |
Output is correct |
224 |
Correct |
455 ms |
36032 KB |
Output is correct |
225 |
Correct |
346 ms |
27732 KB |
Output is correct |
226 |
Correct |
342 ms |
27748 KB |
Output is correct |
227 |
Correct |
318 ms |
27780 KB |
Output is correct |
228 |
Correct |
260 ms |
25800 KB |
Output is correct |
229 |
Correct |
214 ms |
23228 KB |
Output is correct |
230 |
Correct |
234 ms |
28432 KB |
Output is correct |
231 |
Correct |
239 ms |
28356 KB |
Output is correct |