#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);
}
///if(g[v].low > g[u].depth{
///u,v is a bridge
///}
}
else if(v != g[u].parent){
g[u].low = min(g[u].low,g[v].depth);
}
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()
{
//freopen("i.txt","r",stdin);
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++){
//cout << *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);
//cout << "\n";
}
for(int i = 0;i < bct.size();i++){
root = i;
dp(i);
}
/*
for(int i = 0;i < bct.size();i++){
cout << i << " " << bct[i].sz << " " << bct[i].dp << " " << bct[i].isArti << "| ";
for(int j = 0;j < bct[i].adj.size();j++){
cout << bct[i].adj[j] << " ";
}
cout << "\n";
}
*/
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++){
//cout << i << " " << branches[j] << "\n";
///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];
///self to arti to another branch
//if(!bct[i].isArti){
// ans += 2ll * (bct[i].sz) * branches[j] * (bct[i].adj.size() - 1);
//}
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);
//if(!bct[i].isArti) ans += (bct[i].sz) * (bct[i].sz - 1) * (bct[i].adj.size());
//cout << i << " " << ans << "\n";
}
cout << ans;
}
Compilation message
count_triplets.cpp: In function 'void dfs(int)':
count_triplets.cpp:25: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:74: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:118:21: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
for(int i = 0;i < biconnected.size();i++){
~~^~~~~~~~~~~~~~~~~~~~
count_triplets.cpp:133:21: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
for(int i = 0;i < bct.size();i++){
~~^~~~~~~~~~~~
count_triplets.cpp:147:21: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
for(int i = 0;i < bct.size();i++){
~~^~~~~~~~~~~~
count_triplets.cpp:151:25: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
for(int j = 0;j < bct[i].adj.size();j++){
~~^~~~~~~~~~~~~~~~~~~
count_triplets.cpp:161: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:164: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 |
10 ms |
8192 KB |
Output is correct |
3 |
Correct |
10 ms |
8192 KB |
Output is correct |
4 |
Correct |
11 ms |
8192 KB |
Output is correct |
5 |
Correct |
10 ms |
8192 KB |
Output is correct |
6 |
Correct |
10 ms |
8192 KB |
Output is correct |
7 |
Correct |
9 ms |
8192 KB |
Output is correct |
8 |
Correct |
9 ms |
8192 KB |
Output is correct |
9 |
Correct |
9 ms |
8196 KB |
Output is correct |
10 |
Correct |
9 ms |
8192 KB |
Output is correct |
11 |
Correct |
10 ms |
8200 KB |
Output is correct |
12 |
Correct |
10 ms |
8164 KB |
Output is correct |
13 |
Correct |
9 ms |
8192 KB |
Output is correct |
14 |
Correct |
9 ms |
8192 KB |
Output is correct |
15 |
Correct |
9 ms |
8192 KB |
Output is correct |
16 |
Correct |
9 ms |
8192 KB |
Output is correct |
17 |
Correct |
9 ms |
8192 KB |
Output is correct |
18 |
Correct |
10 ms |
8192 KB |
Output is correct |
19 |
Correct |
10 ms |
8192 KB |
Output is correct |
20 |
Correct |
9 ms |
8192 KB |
Output is correct |
21 |
Correct |
9 ms |
8164 KB |
Output is correct |
22 |
Correct |
10 ms |
8192 KB |
Output is correct |
23 |
Correct |
11 ms |
8192 KB |
Output is correct |
24 |
Correct |
11 ms |
8192 KB |
Output is correct |
25 |
Correct |
10 ms |
8192 KB |
Output is correct |
26 |
Correct |
11 ms |
8192 KB |
Output is correct |
27 |
Correct |
14 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 |
9 ms |
8108 KB |
Output is correct |
31 |
Correct |
13 ms |
8192 KB |
Output is correct |
32 |
Correct |
10 ms |
8192 KB |
Output is correct |
33 |
Correct |
9 ms |
8192 KB |
Output is correct |
34 |
Correct |
10 ms |
8192 KB |
Output is correct |
35 |
Correct |
11 ms |
8192 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
9 ms |
8192 KB |
Output is correct |
2 |
Correct |
10 ms |
8192 KB |
Output is correct |
3 |
Correct |
10 ms |
8192 KB |
Output is correct |
4 |
Correct |
11 ms |
8192 KB |
Output is correct |
5 |
Correct |
10 ms |
8192 KB |
Output is correct |
6 |
Correct |
10 ms |
8192 KB |
Output is correct |
7 |
Correct |
9 ms |
8192 KB |
Output is correct |
8 |
Correct |
9 ms |
8192 KB |
Output is correct |
9 |
Correct |
9 ms |
8196 KB |
Output is correct |
10 |
Correct |
9 ms |
8192 KB |
Output is correct |
11 |
Correct |
10 ms |
8200 KB |
Output is correct |
12 |
Correct |
10 ms |
8164 KB |
Output is correct |
13 |
Correct |
9 ms |
8192 KB |
Output is correct |
14 |
Correct |
9 ms |
8192 KB |
Output is correct |
15 |
Correct |
9 ms |
8192 KB |
Output is correct |
16 |
Correct |
9 ms |
8192 KB |
Output is correct |
17 |
Correct |
9 ms |
8192 KB |
Output is correct |
18 |
Correct |
10 ms |
8192 KB |
Output is correct |
19 |
Correct |
10 ms |
8192 KB |
Output is correct |
20 |
Correct |
9 ms |
8192 KB |
Output is correct |
21 |
Correct |
9 ms |
8164 KB |
Output is correct |
22 |
Correct |
10 ms |
8192 KB |
Output is correct |
23 |
Correct |
11 ms |
8192 KB |
Output is correct |
24 |
Correct |
11 ms |
8192 KB |
Output is correct |
25 |
Correct |
10 ms |
8192 KB |
Output is correct |
26 |
Correct |
11 ms |
8192 KB |
Output is correct |
27 |
Correct |
14 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 |
9 ms |
8108 KB |
Output is correct |
31 |
Correct |
13 ms |
8192 KB |
Output is correct |
32 |
Correct |
10 ms |
8192 KB |
Output is correct |
33 |
Correct |
9 ms |
8192 KB |
Output is correct |
34 |
Correct |
10 ms |
8192 KB |
Output is correct |
35 |
Correct |
11 ms |
8192 KB |
Output is correct |
36 |
Correct |
9 ms |
8192 KB |
Output is correct |
37 |
Correct |
10 ms |
8192 KB |
Output is correct |
38 |
Correct |
11 ms |
8176 KB |
Output is correct |
39 |
Correct |
9 ms |
8192 KB |
Output is correct |
40 |
Correct |
9 ms |
8192 KB |
Output is correct |
41 |
Correct |
9 ms |
8192 KB |
Output is correct |
42 |
Correct |
10 ms |
8096 KB |
Output is correct |
43 |
Correct |
10 ms |
8192 KB |
Output is correct |
44 |
Correct |
11 ms |
8192 KB |
Output is correct |
45 |
Correct |
10 ms |
8192 KB |
Output is correct |
46 |
Correct |
9 ms |
8128 KB |
Output is correct |
47 |
Correct |
9 ms |
8192 KB |
Output is correct |
48 |
Correct |
10 ms |
8192 KB |
Output is correct |
49 |
Correct |
9 ms |
8192 KB |
Output is correct |
50 |
Correct |
9 ms |
8192 KB |
Output is correct |
51 |
Correct |
14 ms |
8192 KB |
Output is correct |
52 |
Correct |
10 ms |
8192 KB |
Output is correct |
53 |
Correct |
10 ms |
8192 KB |
Output is correct |
54 |
Correct |
10 ms |
8192 KB |
Output is correct |
55 |
Correct |
10 ms |
8192 KB |
Output is correct |
56 |
Correct |
10 ms |
8112 KB |
Output is correct |
57 |
Correct |
10 ms |
8164 KB |
Output is correct |
58 |
Correct |
13 ms |
8192 KB |
Output is correct |
59 |
Correct |
11 ms |
8192 KB |
Output is correct |
60 |
Correct |
9 ms |
8192 KB |
Output is correct |
61 |
Correct |
11 ms |
8192 KB |
Output is correct |
62 |
Correct |
11 ms |
8192 KB |
Output is correct |
63 |
Correct |
12 ms |
8192 KB |
Output is correct |
64 |
Correct |
10 ms |
8192 KB |
Output is correct |
65 |
Correct |
10 ms |
8192 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
234 ms |
33456 KB |
Output is correct |
2 |
Correct |
233 ms |
33416 KB |
Output is correct |
3 |
Correct |
367 ms |
41284 KB |
Output is correct |
4 |
Correct |
291 ms |
37636 KB |
Output is correct |
5 |
Correct |
306 ms |
37412 KB |
Output is correct |
6 |
Correct |
378 ms |
40924 KB |
Output is correct |
7 |
Correct |
378 ms |
39992 KB |
Output is correct |
8 |
Correct |
376 ms |
41404 KB |
Output is correct |
9 |
Correct |
424 ms |
38504 KB |
Output is correct |
10 |
Correct |
411 ms |
36664 KB |
Output is correct |
11 |
Correct |
232 ms |
32324 KB |
Output is correct |
12 |
Correct |
227 ms |
32068 KB |
Output is correct |
13 |
Correct |
195 ms |
31552 KB |
Output is correct |
14 |
Correct |
195 ms |
31340 KB |
Output is correct |
15 |
Correct |
137 ms |
24900 KB |
Output is correct |
16 |
Correct |
170 ms |
24544 KB |
Output is correct |
17 |
Correct |
10 ms |
8220 KB |
Output is correct |
18 |
Correct |
11 ms |
8192 KB |
Output is correct |
19 |
Correct |
12 ms |
8192 KB |
Output is correct |
20 |
Correct |
16 ms |
8192 KB |
Output is correct |
21 |
Correct |
12 ms |
8192 KB |
Output is correct |
22 |
Correct |
11 ms |
8192 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
11 ms |
8576 KB |
Output is correct |
2 |
Correct |
12 ms |
8572 KB |
Output is correct |
3 |
Correct |
14 ms |
8576 KB |
Output is correct |
4 |
Correct |
14 ms |
8704 KB |
Output is correct |
5 |
Correct |
16 ms |
8704 KB |
Output is correct |
6 |
Correct |
12 ms |
8604 KB |
Output is correct |
7 |
Correct |
13 ms |
8640 KB |
Output is correct |
8 |
Correct |
11 ms |
8548 KB |
Output is correct |
9 |
Correct |
14 ms |
8576 KB |
Output is correct |
10 |
Correct |
13 ms |
8576 KB |
Output is correct |
11 |
Correct |
12 ms |
8612 KB |
Output is correct |
12 |
Correct |
12 ms |
8576 KB |
Output is correct |
13 |
Correct |
12 ms |
8576 KB |
Output is correct |
14 |
Correct |
16 ms |
8448 KB |
Output is correct |
15 |
Correct |
13 ms |
8568 KB |
Output is correct |
16 |
Correct |
12 ms |
8392 KB |
Output is correct |
17 |
Correct |
12 ms |
8492 KB |
Output is correct |
18 |
Correct |
11 ms |
8448 KB |
Output is correct |
19 |
Correct |
10 ms |
8448 KB |
Output is correct |
20 |
Correct |
11 ms |
8448 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
466 ms |
49716 KB |
Output is correct |
2 |
Correct |
425 ms |
49844 KB |
Output is correct |
3 |
Correct |
428 ms |
50028 KB |
Output is correct |
4 |
Correct |
441 ms |
49728 KB |
Output is correct |
5 |
Correct |
413 ms |
49796 KB |
Output is correct |
6 |
Correct |
637 ms |
58220 KB |
Output is correct |
7 |
Correct |
457 ms |
55324 KB |
Output is correct |
8 |
Correct |
430 ms |
54044 KB |
Output is correct |
9 |
Correct |
435 ms |
52536 KB |
Output is correct |
10 |
Correct |
454 ms |
49928 KB |
Output is correct |
11 |
Correct |
376 ms |
49868 KB |
Output is correct |
12 |
Correct |
470 ms |
49804 KB |
Output is correct |
13 |
Correct |
415 ms |
49832 KB |
Output is correct |
14 |
Correct |
436 ms |
48180 KB |
Output is correct |
15 |
Correct |
319 ms |
38520 KB |
Output is correct |
16 |
Correct |
195 ms |
29904 KB |
Output is correct |
17 |
Correct |
244 ms |
41772 KB |
Output is correct |
18 |
Correct |
273 ms |
41396 KB |
Output is correct |
19 |
Correct |
203 ms |
41260 KB |
Output is correct |
20 |
Correct |
206 ms |
41380 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
11 ms |
8576 KB |
Output is correct |
2 |
Correct |
16 ms |
8496 KB |
Output is correct |
3 |
Correct |
15 ms |
8548 KB |
Output is correct |
4 |
Correct |
14 ms |
8448 KB |
Output is correct |
5 |
Correct |
11 ms |
8320 KB |
Output is correct |
6 |
Correct |
11 ms |
8320 KB |
Output is correct |
7 |
Correct |
11 ms |
8320 KB |
Output is correct |
8 |
Correct |
13 ms |
8320 KB |
Output is correct |
9 |
Correct |
11 ms |
8320 KB |
Output is correct |
10 |
Correct |
15 ms |
8320 KB |
Output is correct |
11 |
Correct |
12 ms |
8312 KB |
Output is correct |
12 |
Correct |
13 ms |
8576 KB |
Output is correct |
13 |
Correct |
15 ms |
8576 KB |
Output is correct |
14 |
Correct |
12 ms |
8576 KB |
Output is correct |
15 |
Correct |
14 ms |
8576 KB |
Output is correct |
16 |
Correct |
12 ms |
8448 KB |
Output is correct |
17 |
Correct |
11 ms |
8448 KB |
Output is correct |
18 |
Correct |
13 ms |
8448 KB |
Output is correct |
19 |
Correct |
12 ms |
8320 KB |
Output is correct |
20 |
Correct |
10 ms |
8320 KB |
Output is correct |
21 |
Correct |
12 ms |
8448 KB |
Output is correct |
22 |
Correct |
11 ms |
8448 KB |
Output is correct |
23 |
Correct |
11 ms |
8448 KB |
Output is correct |
24 |
Correct |
17 ms |
8448 KB |
Output is correct |
25 |
Correct |
12 ms |
8192 KB |
Output is correct |
26 |
Correct |
11 ms |
8160 KB |
Output is correct |
27 |
Correct |
10 ms |
8320 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
417 ms |
49680 KB |
Output is correct |
2 |
Correct |
366 ms |
49720 KB |
Output is correct |
3 |
Correct |
394 ms |
48628 KB |
Output is correct |
4 |
Correct |
378 ms |
35556 KB |
Output is correct |
5 |
Correct |
329 ms |
28908 KB |
Output is correct |
6 |
Correct |
295 ms |
25820 KB |
Output is correct |
7 |
Correct |
273 ms |
25552 KB |
Output is correct |
8 |
Correct |
361 ms |
21968 KB |
Output is correct |
9 |
Correct |
242 ms |
21588 KB |
Output is correct |
10 |
Correct |
261 ms |
20248 KB |
Output is correct |
11 |
Correct |
253 ms |
19068 KB |
Output is correct |
12 |
Correct |
175 ms |
18524 KB |
Output is correct |
13 |
Correct |
179 ms |
18572 KB |
Output is correct |
14 |
Correct |
198 ms |
21852 KB |
Output is correct |
15 |
Correct |
429 ms |
55084 KB |
Output is correct |
16 |
Correct |
441 ms |
52972 KB |
Output is correct |
17 |
Correct |
385 ms |
46036 KB |
Output is correct |
18 |
Correct |
349 ms |
43688 KB |
Output is correct |
19 |
Correct |
299 ms |
35392 KB |
Output is correct |
20 |
Correct |
307 ms |
35364 KB |
Output is correct |
21 |
Correct |
323 ms |
35364 KB |
Output is correct |
22 |
Correct |
277 ms |
33728 KB |
Output is correct |
23 |
Correct |
231 ms |
28112 KB |
Output is correct |
24 |
Correct |
331 ms |
41032 KB |
Output is correct |
25 |
Correct |
366 ms |
40988 KB |
Output is correct |
26 |
Correct |
342 ms |
38772 KB |
Output is correct |
27 |
Correct |
342 ms |
38652 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
9 ms |
8192 KB |
Output is correct |
2 |
Correct |
10 ms |
8192 KB |
Output is correct |
3 |
Correct |
10 ms |
8192 KB |
Output is correct |
4 |
Correct |
11 ms |
8192 KB |
Output is correct |
5 |
Correct |
10 ms |
8192 KB |
Output is correct |
6 |
Correct |
10 ms |
8192 KB |
Output is correct |
7 |
Correct |
9 ms |
8192 KB |
Output is correct |
8 |
Correct |
9 ms |
8192 KB |
Output is correct |
9 |
Correct |
9 ms |
8196 KB |
Output is correct |
10 |
Correct |
9 ms |
8192 KB |
Output is correct |
11 |
Correct |
10 ms |
8200 KB |
Output is correct |
12 |
Correct |
10 ms |
8164 KB |
Output is correct |
13 |
Correct |
9 ms |
8192 KB |
Output is correct |
14 |
Correct |
9 ms |
8192 KB |
Output is correct |
15 |
Correct |
9 ms |
8192 KB |
Output is correct |
16 |
Correct |
9 ms |
8192 KB |
Output is correct |
17 |
Correct |
9 ms |
8192 KB |
Output is correct |
18 |
Correct |
10 ms |
8192 KB |
Output is correct |
19 |
Correct |
10 ms |
8192 KB |
Output is correct |
20 |
Correct |
9 ms |
8192 KB |
Output is correct |
21 |
Correct |
9 ms |
8164 KB |
Output is correct |
22 |
Correct |
10 ms |
8192 KB |
Output is correct |
23 |
Correct |
11 ms |
8192 KB |
Output is correct |
24 |
Correct |
11 ms |
8192 KB |
Output is correct |
25 |
Correct |
10 ms |
8192 KB |
Output is correct |
26 |
Correct |
11 ms |
8192 KB |
Output is correct |
27 |
Correct |
14 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 |
9 ms |
8108 KB |
Output is correct |
31 |
Correct |
13 ms |
8192 KB |
Output is correct |
32 |
Correct |
10 ms |
8192 KB |
Output is correct |
33 |
Correct |
9 ms |
8192 KB |
Output is correct |
34 |
Correct |
10 ms |
8192 KB |
Output is correct |
35 |
Correct |
11 ms |
8192 KB |
Output is correct |
36 |
Correct |
9 ms |
8192 KB |
Output is correct |
37 |
Correct |
10 ms |
8192 KB |
Output is correct |
38 |
Correct |
11 ms |
8176 KB |
Output is correct |
39 |
Correct |
9 ms |
8192 KB |
Output is correct |
40 |
Correct |
9 ms |
8192 KB |
Output is correct |
41 |
Correct |
9 ms |
8192 KB |
Output is correct |
42 |
Correct |
10 ms |
8096 KB |
Output is correct |
43 |
Correct |
10 ms |
8192 KB |
Output is correct |
44 |
Correct |
11 ms |
8192 KB |
Output is correct |
45 |
Correct |
10 ms |
8192 KB |
Output is correct |
46 |
Correct |
9 ms |
8128 KB |
Output is correct |
47 |
Correct |
9 ms |
8192 KB |
Output is correct |
48 |
Correct |
10 ms |
8192 KB |
Output is correct |
49 |
Correct |
9 ms |
8192 KB |
Output is correct |
50 |
Correct |
9 ms |
8192 KB |
Output is correct |
51 |
Correct |
14 ms |
8192 KB |
Output is correct |
52 |
Correct |
10 ms |
8192 KB |
Output is correct |
53 |
Correct |
10 ms |
8192 KB |
Output is correct |
54 |
Correct |
10 ms |
8192 KB |
Output is correct |
55 |
Correct |
10 ms |
8192 KB |
Output is correct |
56 |
Correct |
10 ms |
8112 KB |
Output is correct |
57 |
Correct |
10 ms |
8164 KB |
Output is correct |
58 |
Correct |
13 ms |
8192 KB |
Output is correct |
59 |
Correct |
11 ms |
8192 KB |
Output is correct |
60 |
Correct |
9 ms |
8192 KB |
Output is correct |
61 |
Correct |
11 ms |
8192 KB |
Output is correct |
62 |
Correct |
11 ms |
8192 KB |
Output is correct |
63 |
Correct |
12 ms |
8192 KB |
Output is correct |
64 |
Correct |
10 ms |
8192 KB |
Output is correct |
65 |
Correct |
10 ms |
8192 KB |
Output is correct |
66 |
Correct |
9 ms |
8192 KB |
Output is correct |
67 |
Correct |
14 ms |
8320 KB |
Output is correct |
68 |
Correct |
12 ms |
8448 KB |
Output is correct |
69 |
Correct |
12 ms |
8448 KB |
Output is correct |
70 |
Correct |
11 ms |
8344 KB |
Output is correct |
71 |
Correct |
15 ms |
8448 KB |
Output is correct |
72 |
Correct |
18 ms |
8320 KB |
Output is correct |
73 |
Correct |
17 ms |
8320 KB |
Output is correct |
74 |
Correct |
14 ms |
8448 KB |
Output is correct |
75 |
Correct |
10 ms |
8320 KB |
Output is correct |
76 |
Correct |
8 ms |
8192 KB |
Output is correct |
77 |
Correct |
10 ms |
8448 KB |
Output is correct |
78 |
Correct |
10 ms |
8448 KB |
Output is correct |
79 |
Correct |
10 ms |
8320 KB |
Output is correct |
80 |
Correct |
10 ms |
8320 KB |
Output is correct |
81 |
Correct |
12 ms |
8320 KB |
Output is correct |
82 |
Correct |
11 ms |
8276 KB |
Output is correct |
83 |
Correct |
11 ms |
8320 KB |
Output is correct |
84 |
Correct |
10 ms |
8448 KB |
Output is correct |
85 |
Correct |
11 ms |
8448 KB |
Output is correct |
86 |
Correct |
15 ms |
8448 KB |
Output is correct |
87 |
Correct |
13 ms |
8320 KB |
Output is correct |
88 |
Correct |
18 ms |
8320 KB |
Output is correct |
89 |
Correct |
14 ms |
8192 KB |
Output is correct |
90 |
Correct |
10 ms |
8320 KB |
Output is correct |
91 |
Correct |
15 ms |
8320 KB |
Output is correct |
92 |
Correct |
14 ms |
8320 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
9 ms |
8192 KB |
Output is correct |
2 |
Correct |
10 ms |
8192 KB |
Output is correct |
3 |
Correct |
10 ms |
8192 KB |
Output is correct |
4 |
Correct |
11 ms |
8192 KB |
Output is correct |
5 |
Correct |
10 ms |
8192 KB |
Output is correct |
6 |
Correct |
10 ms |
8192 KB |
Output is correct |
7 |
Correct |
9 ms |
8192 KB |
Output is correct |
8 |
Correct |
9 ms |
8192 KB |
Output is correct |
9 |
Correct |
9 ms |
8196 KB |
Output is correct |
10 |
Correct |
9 ms |
8192 KB |
Output is correct |
11 |
Correct |
10 ms |
8200 KB |
Output is correct |
12 |
Correct |
10 ms |
8164 KB |
Output is correct |
13 |
Correct |
9 ms |
8192 KB |
Output is correct |
14 |
Correct |
9 ms |
8192 KB |
Output is correct |
15 |
Correct |
9 ms |
8192 KB |
Output is correct |
16 |
Correct |
9 ms |
8192 KB |
Output is correct |
17 |
Correct |
9 ms |
8192 KB |
Output is correct |
18 |
Correct |
10 ms |
8192 KB |
Output is correct |
19 |
Correct |
10 ms |
8192 KB |
Output is correct |
20 |
Correct |
9 ms |
8192 KB |
Output is correct |
21 |
Correct |
9 ms |
8164 KB |
Output is correct |
22 |
Correct |
10 ms |
8192 KB |
Output is correct |
23 |
Correct |
11 ms |
8192 KB |
Output is correct |
24 |
Correct |
11 ms |
8192 KB |
Output is correct |
25 |
Correct |
10 ms |
8192 KB |
Output is correct |
26 |
Correct |
11 ms |
8192 KB |
Output is correct |
27 |
Correct |
14 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 |
9 ms |
8108 KB |
Output is correct |
31 |
Correct |
13 ms |
8192 KB |
Output is correct |
32 |
Correct |
10 ms |
8192 KB |
Output is correct |
33 |
Correct |
9 ms |
8192 KB |
Output is correct |
34 |
Correct |
10 ms |
8192 KB |
Output is correct |
35 |
Correct |
11 ms |
8192 KB |
Output is correct |
36 |
Correct |
9 ms |
8192 KB |
Output is correct |
37 |
Correct |
10 ms |
8192 KB |
Output is correct |
38 |
Correct |
11 ms |
8176 KB |
Output is correct |
39 |
Correct |
9 ms |
8192 KB |
Output is correct |
40 |
Correct |
9 ms |
8192 KB |
Output is correct |
41 |
Correct |
9 ms |
8192 KB |
Output is correct |
42 |
Correct |
10 ms |
8096 KB |
Output is correct |
43 |
Correct |
10 ms |
8192 KB |
Output is correct |
44 |
Correct |
11 ms |
8192 KB |
Output is correct |
45 |
Correct |
10 ms |
8192 KB |
Output is correct |
46 |
Correct |
9 ms |
8128 KB |
Output is correct |
47 |
Correct |
9 ms |
8192 KB |
Output is correct |
48 |
Correct |
10 ms |
8192 KB |
Output is correct |
49 |
Correct |
9 ms |
8192 KB |
Output is correct |
50 |
Correct |
9 ms |
8192 KB |
Output is correct |
51 |
Correct |
14 ms |
8192 KB |
Output is correct |
52 |
Correct |
10 ms |
8192 KB |
Output is correct |
53 |
Correct |
10 ms |
8192 KB |
Output is correct |
54 |
Correct |
10 ms |
8192 KB |
Output is correct |
55 |
Correct |
10 ms |
8192 KB |
Output is correct |
56 |
Correct |
10 ms |
8112 KB |
Output is correct |
57 |
Correct |
10 ms |
8164 KB |
Output is correct |
58 |
Correct |
13 ms |
8192 KB |
Output is correct |
59 |
Correct |
11 ms |
8192 KB |
Output is correct |
60 |
Correct |
9 ms |
8192 KB |
Output is correct |
61 |
Correct |
11 ms |
8192 KB |
Output is correct |
62 |
Correct |
11 ms |
8192 KB |
Output is correct |
63 |
Correct |
12 ms |
8192 KB |
Output is correct |
64 |
Correct |
10 ms |
8192 KB |
Output is correct |
65 |
Correct |
10 ms |
8192 KB |
Output is correct |
66 |
Correct |
234 ms |
33456 KB |
Output is correct |
67 |
Correct |
233 ms |
33416 KB |
Output is correct |
68 |
Correct |
367 ms |
41284 KB |
Output is correct |
69 |
Correct |
291 ms |
37636 KB |
Output is correct |
70 |
Correct |
306 ms |
37412 KB |
Output is correct |
71 |
Correct |
378 ms |
40924 KB |
Output is correct |
72 |
Correct |
378 ms |
39992 KB |
Output is correct |
73 |
Correct |
376 ms |
41404 KB |
Output is correct |
74 |
Correct |
424 ms |
38504 KB |
Output is correct |
75 |
Correct |
411 ms |
36664 KB |
Output is correct |
76 |
Correct |
232 ms |
32324 KB |
Output is correct |
77 |
Correct |
227 ms |
32068 KB |
Output is correct |
78 |
Correct |
195 ms |
31552 KB |
Output is correct |
79 |
Correct |
195 ms |
31340 KB |
Output is correct |
80 |
Correct |
137 ms |
24900 KB |
Output is correct |
81 |
Correct |
170 ms |
24544 KB |
Output is correct |
82 |
Correct |
10 ms |
8220 KB |
Output is correct |
83 |
Correct |
11 ms |
8192 KB |
Output is correct |
84 |
Correct |
12 ms |
8192 KB |
Output is correct |
85 |
Correct |
16 ms |
8192 KB |
Output is correct |
86 |
Correct |
12 ms |
8192 KB |
Output is correct |
87 |
Correct |
11 ms |
8192 KB |
Output is correct |
88 |
Correct |
11 ms |
8576 KB |
Output is correct |
89 |
Correct |
12 ms |
8572 KB |
Output is correct |
90 |
Correct |
14 ms |
8576 KB |
Output is correct |
91 |
Correct |
14 ms |
8704 KB |
Output is correct |
92 |
Correct |
16 ms |
8704 KB |
Output is correct |
93 |
Correct |
12 ms |
8604 KB |
Output is correct |
94 |
Correct |
13 ms |
8640 KB |
Output is correct |
95 |
Correct |
11 ms |
8548 KB |
Output is correct |
96 |
Correct |
14 ms |
8576 KB |
Output is correct |
97 |
Correct |
13 ms |
8576 KB |
Output is correct |
98 |
Correct |
12 ms |
8612 KB |
Output is correct |
99 |
Correct |
12 ms |
8576 KB |
Output is correct |
100 |
Correct |
12 ms |
8576 KB |
Output is correct |
101 |
Correct |
16 ms |
8448 KB |
Output is correct |
102 |
Correct |
13 ms |
8568 KB |
Output is correct |
103 |
Correct |
12 ms |
8392 KB |
Output is correct |
104 |
Correct |
12 ms |
8492 KB |
Output is correct |
105 |
Correct |
11 ms |
8448 KB |
Output is correct |
106 |
Correct |
10 ms |
8448 KB |
Output is correct |
107 |
Correct |
11 ms |
8448 KB |
Output is correct |
108 |
Correct |
466 ms |
49716 KB |
Output is correct |
109 |
Correct |
425 ms |
49844 KB |
Output is correct |
110 |
Correct |
428 ms |
50028 KB |
Output is correct |
111 |
Correct |
441 ms |
49728 KB |
Output is correct |
112 |
Correct |
413 ms |
49796 KB |
Output is correct |
113 |
Correct |
637 ms |
58220 KB |
Output is correct |
114 |
Correct |
457 ms |
55324 KB |
Output is correct |
115 |
Correct |
430 ms |
54044 KB |
Output is correct |
116 |
Correct |
435 ms |
52536 KB |
Output is correct |
117 |
Correct |
454 ms |
49928 KB |
Output is correct |
118 |
Correct |
376 ms |
49868 KB |
Output is correct |
119 |
Correct |
470 ms |
49804 KB |
Output is correct |
120 |
Correct |
415 ms |
49832 KB |
Output is correct |
121 |
Correct |
436 ms |
48180 KB |
Output is correct |
122 |
Correct |
319 ms |
38520 KB |
Output is correct |
123 |
Correct |
195 ms |
29904 KB |
Output is correct |
124 |
Correct |
244 ms |
41772 KB |
Output is correct |
125 |
Correct |
273 ms |
41396 KB |
Output is correct |
126 |
Correct |
203 ms |
41260 KB |
Output is correct |
127 |
Correct |
206 ms |
41380 KB |
Output is correct |
128 |
Correct |
11 ms |
8576 KB |
Output is correct |
129 |
Correct |
16 ms |
8496 KB |
Output is correct |
130 |
Correct |
15 ms |
8548 KB |
Output is correct |
131 |
Correct |
14 ms |
8448 KB |
Output is correct |
132 |
Correct |
11 ms |
8320 KB |
Output is correct |
133 |
Correct |
11 ms |
8320 KB |
Output is correct |
134 |
Correct |
11 ms |
8320 KB |
Output is correct |
135 |
Correct |
13 ms |
8320 KB |
Output is correct |
136 |
Correct |
11 ms |
8320 KB |
Output is correct |
137 |
Correct |
15 ms |
8320 KB |
Output is correct |
138 |
Correct |
12 ms |
8312 KB |
Output is correct |
139 |
Correct |
13 ms |
8576 KB |
Output is correct |
140 |
Correct |
15 ms |
8576 KB |
Output is correct |
141 |
Correct |
12 ms |
8576 KB |
Output is correct |
142 |
Correct |
14 ms |
8576 KB |
Output is correct |
143 |
Correct |
12 ms |
8448 KB |
Output is correct |
144 |
Correct |
11 ms |
8448 KB |
Output is correct |
145 |
Correct |
13 ms |
8448 KB |
Output is correct |
146 |
Correct |
12 ms |
8320 KB |
Output is correct |
147 |
Correct |
10 ms |
8320 KB |
Output is correct |
148 |
Correct |
12 ms |
8448 KB |
Output is correct |
149 |
Correct |
11 ms |
8448 KB |
Output is correct |
150 |
Correct |
11 ms |
8448 KB |
Output is correct |
151 |
Correct |
17 ms |
8448 KB |
Output is correct |
152 |
Correct |
12 ms |
8192 KB |
Output is correct |
153 |
Correct |
11 ms |
8160 KB |
Output is correct |
154 |
Correct |
10 ms |
8320 KB |
Output is correct |
155 |
Correct |
417 ms |
49680 KB |
Output is correct |
156 |
Correct |
366 ms |
49720 KB |
Output is correct |
157 |
Correct |
394 ms |
48628 KB |
Output is correct |
158 |
Correct |
378 ms |
35556 KB |
Output is correct |
159 |
Correct |
329 ms |
28908 KB |
Output is correct |
160 |
Correct |
295 ms |
25820 KB |
Output is correct |
161 |
Correct |
273 ms |
25552 KB |
Output is correct |
162 |
Correct |
361 ms |
21968 KB |
Output is correct |
163 |
Correct |
242 ms |
21588 KB |
Output is correct |
164 |
Correct |
261 ms |
20248 KB |
Output is correct |
165 |
Correct |
253 ms |
19068 KB |
Output is correct |
166 |
Correct |
175 ms |
18524 KB |
Output is correct |
167 |
Correct |
179 ms |
18572 KB |
Output is correct |
168 |
Correct |
198 ms |
21852 KB |
Output is correct |
169 |
Correct |
429 ms |
55084 KB |
Output is correct |
170 |
Correct |
441 ms |
52972 KB |
Output is correct |
171 |
Correct |
385 ms |
46036 KB |
Output is correct |
172 |
Correct |
349 ms |
43688 KB |
Output is correct |
173 |
Correct |
299 ms |
35392 KB |
Output is correct |
174 |
Correct |
307 ms |
35364 KB |
Output is correct |
175 |
Correct |
323 ms |
35364 KB |
Output is correct |
176 |
Correct |
277 ms |
33728 KB |
Output is correct |
177 |
Correct |
231 ms |
28112 KB |
Output is correct |
178 |
Correct |
331 ms |
41032 KB |
Output is correct |
179 |
Correct |
366 ms |
40988 KB |
Output is correct |
180 |
Correct |
342 ms |
38772 KB |
Output is correct |
181 |
Correct |
342 ms |
38652 KB |
Output is correct |
182 |
Correct |
9 ms |
8192 KB |
Output is correct |
183 |
Correct |
14 ms |
8320 KB |
Output is correct |
184 |
Correct |
12 ms |
8448 KB |
Output is correct |
185 |
Correct |
12 ms |
8448 KB |
Output is correct |
186 |
Correct |
11 ms |
8344 KB |
Output is correct |
187 |
Correct |
15 ms |
8448 KB |
Output is correct |
188 |
Correct |
18 ms |
8320 KB |
Output is correct |
189 |
Correct |
17 ms |
8320 KB |
Output is correct |
190 |
Correct |
14 ms |
8448 KB |
Output is correct |
191 |
Correct |
10 ms |
8320 KB |
Output is correct |
192 |
Correct |
8 ms |
8192 KB |
Output is correct |
193 |
Correct |
10 ms |
8448 KB |
Output is correct |
194 |
Correct |
10 ms |
8448 KB |
Output is correct |
195 |
Correct |
10 ms |
8320 KB |
Output is correct |
196 |
Correct |
10 ms |
8320 KB |
Output is correct |
197 |
Correct |
12 ms |
8320 KB |
Output is correct |
198 |
Correct |
11 ms |
8276 KB |
Output is correct |
199 |
Correct |
11 ms |
8320 KB |
Output is correct |
200 |
Correct |
10 ms |
8448 KB |
Output is correct |
201 |
Correct |
11 ms |
8448 KB |
Output is correct |
202 |
Correct |
15 ms |
8448 KB |
Output is correct |
203 |
Correct |
13 ms |
8320 KB |
Output is correct |
204 |
Correct |
18 ms |
8320 KB |
Output is correct |
205 |
Correct |
14 ms |
8192 KB |
Output is correct |
206 |
Correct |
10 ms |
8320 KB |
Output is correct |
207 |
Correct |
15 ms |
8320 KB |
Output is correct |
208 |
Correct |
14 ms |
8320 KB |
Output is correct |
209 |
Correct |
13 ms |
8192 KB |
Output is correct |
210 |
Correct |
218 ms |
29508 KB |
Output is correct |
211 |
Correct |
328 ms |
31732 KB |
Output is correct |
212 |
Correct |
349 ms |
33512 KB |
Output is correct |
213 |
Correct |
329 ms |
32272 KB |
Output is correct |
214 |
Correct |
183 ms |
28072 KB |
Output is correct |
215 |
Correct |
193 ms |
25948 KB |
Output is correct |
216 |
Correct |
392 ms |
38684 KB |
Output is correct |
217 |
Correct |
285 ms |
29888 KB |
Output is correct |
218 |
Correct |
309 ms |
22136 KB |
Output is correct |
219 |
Correct |
246 ms |
19988 KB |
Output is correct |
220 |
Correct |
223 ms |
19084 KB |
Output is correct |
221 |
Correct |
206 ms |
18168 KB |
Output is correct |
222 |
Correct |
234 ms |
20228 KB |
Output is correct |
223 |
Correct |
346 ms |
38456 KB |
Output is correct |
224 |
Correct |
310 ms |
37032 KB |
Output is correct |
225 |
Correct |
288 ms |
28712 KB |
Output is correct |
226 |
Correct |
292 ms |
28776 KB |
Output is correct |
227 |
Correct |
411 ms |
28868 KB |
Output is correct |
228 |
Correct |
330 ms |
26552 KB |
Output is correct |
229 |
Correct |
211 ms |
23644 KB |
Output is correct |
230 |
Correct |
269 ms |
29508 KB |
Output is correct |
231 |
Correct |
236 ms |
29516 KB |
Output is correct |