#include <bits/stdc++.h>
#define all(x) x.begin(),x.end()
#define debug //printf
#define sz(x) (int)(x.size())
#define pii pair<int,int>
#define ff first
#define ss second
#define ll long long
using namespace std ;
int n , m ;
vector<int> height, low , qtdVert , subtree ;
vector<ll> toSubtract ;
vector< vector<int> > biconnected , tree ;
vector<pii> edges ;
vector< vector<pii> > adj ;
vector<bool> seenEdge , isArt , seenVertex , spun ;
ll ans ;
// ------------------ GETTING ARTICULATION POINTS AND BICONNECTED COMPONENTS
stack<int> st ;
void makeComponent(int lastIncluded)
{
biconnected.push_back( vector<int>() ) ;
tree.push_back( vector<int>() ) ;
toSubtract.push_back(0LL) ;
qtdVert.push_back(0) ;
subtree.push_back(0) ;
spun.push_back(false) ;
while( !st.empty() )
{
int onTop = st.top() ;
st.pop() ;
biconnected.back().push_back( onTop ) ;
if(onTop == lastIncluded) return ;
}
}
void lowlink(int x, bool isFirst = false )
{
bool hasFwd = false ;
seenVertex[x] = true ;
for(auto e : adj[x] )
{
int target = e.ff ;
int id = e.ss ;
if( seenEdge[id] ) continue ;
st.push( id ) ;
seenEdge[id] = true ;
if( height[target] != -1 )
{
low[x] = min( low[x] , height[target] ) ;
continue ;
}
height[target] = low[target] = height[x] + 1 ;
lowlink( target ) ;
low[x] = min( low[x] , low[target] ) ;
if( (isFirst) ? hasFwd : (low[target] >= height[x]) )
{
isArt[x] = true ;
makeComponent(id) ;
}
hasFwd = true ;
}
}
// -----------------------------
void dfsInit(int x, int father )
{
subtree[x] = qtdVert[x] ;
for(auto neigh : tree[x] )
{
if(neigh == father) continue ;
dfsInit(neigh, x) ;
subtree[x] += subtree[neigh] ;
}
}
long long binomial(ll x) { return ((x-1)*x)/2LL ; }
void dfsSpin(int x)
{
spun[x] = true ;
if( x >= n )
{
//I'm a component
for(int neigh : tree[x] )
toSubtract[x] += binomial( (ll)subtree[neigh] ) ;
ans -= toSubtract[x] * (ll)qtdVert[x] ;
}
for(int neigh : tree[x])
{
if( spun[neigh] ) continue ;
int mySub = subtree[x] ;
int yourSub = subtree[neigh] ;
subtree[x] -= subtree[neigh] ;
subtree[neigh] = mySub ;
dfsSpin(neigh) ;
subtree[x] = mySub ;
subtree[neigh] = yourSub ;
}
if( x < n )
{
//I'm an articulation point
for(int neigh : tree[x])
toSubtract[x] += toSubtract[neigh] - binomial( (ll) subtree[x] - subtree[neigh] ) ;
ans -= toSubtract[x] ;
}
}
int main()
{
scanf("%d%d", &n , &m ) ;
adj.resize(n, vector<pii>() ) ;
seenEdge.resize(m, false) ;
seenVertex.resize(n, false) ;
tree.resize(n, vector<int>() ) ;
height.resize(n, -1) ;
low.resize(n) ;
isArt.resize(n, false) ;
toSubtract.resize(n, 0LL ) ;
qtdVert.resize(n, 1) ;
subtree.resize(n, 0) ;
spun.resize(n, false) ;
for(int i = 0 , a , b ; i < m ; i++ )
{
scanf("%d%d", &a, &b ) ;
a-- ;
b-- ;
adj[a].push_back( make_pair(b,i) ) ;
adj[b].push_back( make_pair(a,i) ) ;
edges.push_back( make_pair(a,b) ) ;
}
for(int i = 0 ; i < n ; i++ )
{
if( seenVertex[i] ) continue ;
int toBegin = sz(biconnected) ;
height[i] = low[i] = 0 ;
lowlink(i, true ) ;
makeComponent(-1) ;
int toEnd = sz(biconnected) ;
for(int j = toBegin ; j < toEnd ; j++ )
{
debug("Component %d: " , j ) ;
vector<int> nonArt ;
for(int e : biconnected[j])
{
nonArt.push_back( edges[e].ff ) ;
nonArt.push_back( edges[e].ss ) ;
debug("(%d %d) and " , edges[e].ff, edges[e].ss ) ;
}
debug("\n") ;
sort(all(nonArt));
nonArt.erase( unique(all(nonArt)) , nonArt.end() ) ;
for(int e : nonArt)
{
if( isArt[e] )
{
tree[e].push_back(n + j) ;
tree[n+j].push_back(e) ;
}
else qtdVert[n+j]++ ;
}
}
dfsInit(n+toBegin, -1) ;
ans += binomial((ll)subtree[n+toBegin]-1) * (ll)subtree[n+toBegin] ;
dfsSpin(n+toBegin) ;
}
printf("%lld\n" , ans*2LL ) ;
}
Compilation message
count_triplets.cpp: In function 'int main()':
count_triplets.cpp:197:10: warning: left operand of comma operator has no effect [-Wunused-value]
197 | debug("Component %d: " , j ) ;
| ^~~~~~~~~~~~~~~~
count_triplets.cpp:205:11: warning: left operand of comma operator has no effect [-Wunused-value]
205 | debug("(%d %d) and " , edges[e].ff, edges[e].ss ) ;
| ^~~~~~~~~~~~~~
count_triplets.cpp:208:10: warning: statement has no effect [-Wunused-value]
208 | debug("\n") ;
| ~^~~~~
count_triplets.cpp:155:7: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
155 | scanf("%d%d", &n , &m ) ;
| ~~~~~^~~~~~~~~~~~~~~~~~
count_triplets.cpp:171:8: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
171 | scanf("%d%d", &a, &b ) ;
| ~~~~~^~~~~~~~~~~~~~~~~
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
256 KB |
Output is correct |
2 |
Correct |
1 ms |
256 KB |
Output is correct |
3 |
Correct |
1 ms |
256 KB |
Output is correct |
4 |
Correct |
1 ms |
256 KB |
Output is correct |
5 |
Correct |
1 ms |
256 KB |
Output is correct |
6 |
Correct |
1 ms |
256 KB |
Output is correct |
7 |
Correct |
1 ms |
256 KB |
Output is correct |
8 |
Correct |
0 ms |
256 KB |
Output is correct |
9 |
Correct |
0 ms |
256 KB |
Output is correct |
10 |
Correct |
1 ms |
256 KB |
Output is correct |
11 |
Correct |
1 ms |
256 KB |
Output is correct |
12 |
Correct |
1 ms |
256 KB |
Output is correct |
13 |
Correct |
1 ms |
256 KB |
Output is correct |
14 |
Correct |
0 ms |
256 KB |
Output is correct |
15 |
Correct |
0 ms |
256 KB |
Output is correct |
16 |
Correct |
1 ms |
256 KB |
Output is correct |
17 |
Correct |
1 ms |
384 KB |
Output is correct |
18 |
Correct |
0 ms |
256 KB |
Output is correct |
19 |
Correct |
1 ms |
256 KB |
Output is correct |
20 |
Correct |
1 ms |
256 KB |
Output is correct |
21 |
Correct |
1 ms |
256 KB |
Output is correct |
22 |
Correct |
1 ms |
256 KB |
Output is correct |
23 |
Correct |
0 ms |
256 KB |
Output is correct |
24 |
Correct |
1 ms |
384 KB |
Output is correct |
25 |
Correct |
1 ms |
384 KB |
Output is correct |
26 |
Correct |
1 ms |
256 KB |
Output is correct |
27 |
Correct |
1 ms |
256 KB |
Output is correct |
28 |
Correct |
0 ms |
256 KB |
Output is correct |
29 |
Correct |
1 ms |
256 KB |
Output is correct |
30 |
Correct |
0 ms |
384 KB |
Output is correct |
31 |
Correct |
1 ms |
256 KB |
Output is correct |
32 |
Correct |
1 ms |
256 KB |
Output is correct |
33 |
Correct |
1 ms |
256 KB |
Output is correct |
34 |
Correct |
0 ms |
256 KB |
Output is correct |
35 |
Correct |
1 ms |
384 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
256 KB |
Output is correct |
2 |
Correct |
1 ms |
256 KB |
Output is correct |
3 |
Correct |
1 ms |
256 KB |
Output is correct |
4 |
Correct |
1 ms |
256 KB |
Output is correct |
5 |
Correct |
1 ms |
256 KB |
Output is correct |
6 |
Correct |
1 ms |
256 KB |
Output is correct |
7 |
Correct |
1 ms |
256 KB |
Output is correct |
8 |
Correct |
0 ms |
256 KB |
Output is correct |
9 |
Correct |
0 ms |
256 KB |
Output is correct |
10 |
Correct |
1 ms |
256 KB |
Output is correct |
11 |
Correct |
1 ms |
256 KB |
Output is correct |
12 |
Correct |
1 ms |
256 KB |
Output is correct |
13 |
Correct |
1 ms |
256 KB |
Output is correct |
14 |
Correct |
0 ms |
256 KB |
Output is correct |
15 |
Correct |
0 ms |
256 KB |
Output is correct |
16 |
Correct |
1 ms |
256 KB |
Output is correct |
17 |
Correct |
1 ms |
384 KB |
Output is correct |
18 |
Correct |
0 ms |
256 KB |
Output is correct |
19 |
Correct |
1 ms |
256 KB |
Output is correct |
20 |
Correct |
1 ms |
256 KB |
Output is correct |
21 |
Correct |
1 ms |
256 KB |
Output is correct |
22 |
Correct |
1 ms |
256 KB |
Output is correct |
23 |
Correct |
0 ms |
256 KB |
Output is correct |
24 |
Correct |
1 ms |
384 KB |
Output is correct |
25 |
Correct |
1 ms |
384 KB |
Output is correct |
26 |
Correct |
1 ms |
256 KB |
Output is correct |
27 |
Correct |
1 ms |
256 KB |
Output is correct |
28 |
Correct |
0 ms |
256 KB |
Output is correct |
29 |
Correct |
1 ms |
256 KB |
Output is correct |
30 |
Correct |
0 ms |
384 KB |
Output is correct |
31 |
Correct |
1 ms |
256 KB |
Output is correct |
32 |
Correct |
1 ms |
256 KB |
Output is correct |
33 |
Correct |
1 ms |
256 KB |
Output is correct |
34 |
Correct |
0 ms |
256 KB |
Output is correct |
35 |
Correct |
1 ms |
384 KB |
Output is correct |
36 |
Correct |
1 ms |
384 KB |
Output is correct |
37 |
Correct |
1 ms |
384 KB |
Output is correct |
38 |
Correct |
1 ms |
384 KB |
Output is correct |
39 |
Correct |
1 ms |
384 KB |
Output is correct |
40 |
Correct |
1 ms |
384 KB |
Output is correct |
41 |
Correct |
1 ms |
384 KB |
Output is correct |
42 |
Correct |
1 ms |
384 KB |
Output is correct |
43 |
Correct |
0 ms |
384 KB |
Output is correct |
44 |
Correct |
1 ms |
384 KB |
Output is correct |
45 |
Correct |
1 ms |
256 KB |
Output is correct |
46 |
Correct |
1 ms |
384 KB |
Output is correct |
47 |
Correct |
0 ms |
384 KB |
Output is correct |
48 |
Correct |
1 ms |
384 KB |
Output is correct |
49 |
Correct |
0 ms |
384 KB |
Output is correct |
50 |
Correct |
1 ms |
384 KB |
Output is correct |
51 |
Correct |
1 ms |
384 KB |
Output is correct |
52 |
Correct |
1 ms |
384 KB |
Output is correct |
53 |
Correct |
1 ms |
384 KB |
Output is correct |
54 |
Correct |
1 ms |
256 KB |
Output is correct |
55 |
Correct |
0 ms |
384 KB |
Output is correct |
56 |
Correct |
1 ms |
384 KB |
Output is correct |
57 |
Correct |
1 ms |
384 KB |
Output is correct |
58 |
Correct |
1 ms |
384 KB |
Output is correct |
59 |
Correct |
1 ms |
384 KB |
Output is correct |
60 |
Correct |
1 ms |
384 KB |
Output is correct |
61 |
Correct |
1 ms |
384 KB |
Output is correct |
62 |
Correct |
1 ms |
384 KB |
Output is correct |
63 |
Correct |
1 ms |
384 KB |
Output is correct |
64 |
Correct |
1 ms |
384 KB |
Output is correct |
65 |
Correct |
1 ms |
384 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
145 ms |
29408 KB |
Output is correct |
2 |
Correct |
134 ms |
29404 KB |
Output is correct |
3 |
Correct |
207 ms |
30056 KB |
Output is correct |
4 |
Correct |
159 ms |
29324 KB |
Output is correct |
5 |
Correct |
179 ms |
24460 KB |
Output is correct |
6 |
Correct |
182 ms |
32160 KB |
Output is correct |
7 |
Correct |
182 ms |
26532 KB |
Output is correct |
8 |
Correct |
172 ms |
29604 KB |
Output is correct |
9 |
Correct |
170 ms |
24228 KB |
Output is correct |
10 |
Correct |
158 ms |
23840 KB |
Output is correct |
11 |
Correct |
132 ms |
18980 KB |
Output is correct |
12 |
Correct |
126 ms |
19012 KB |
Output is correct |
13 |
Correct |
119 ms |
18340 KB |
Output is correct |
14 |
Correct |
114 ms |
18340 KB |
Output is correct |
15 |
Correct |
88 ms |
17064 KB |
Output is correct |
16 |
Correct |
92 ms |
17192 KB |
Output is correct |
17 |
Correct |
21 ms |
16824 KB |
Output is correct |
18 |
Correct |
20 ms |
16824 KB |
Output is correct |
19 |
Correct |
20 ms |
16824 KB |
Output is correct |
20 |
Correct |
19 ms |
16824 KB |
Output is correct |
21 |
Correct |
20 ms |
16824 KB |
Output is correct |
22 |
Correct |
20 ms |
16824 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
2 ms |
640 KB |
Output is correct |
2 |
Correct |
2 ms |
640 KB |
Output is correct |
3 |
Correct |
2 ms |
640 KB |
Output is correct |
4 |
Correct |
2 ms |
768 KB |
Output is correct |
5 |
Correct |
2 ms |
640 KB |
Output is correct |
6 |
Correct |
2 ms |
640 KB |
Output is correct |
7 |
Correct |
2 ms |
768 KB |
Output is correct |
8 |
Correct |
2 ms |
640 KB |
Output is correct |
9 |
Correct |
2 ms |
640 KB |
Output is correct |
10 |
Correct |
2 ms |
640 KB |
Output is correct |
11 |
Correct |
2 ms |
640 KB |
Output is correct |
12 |
Correct |
2 ms |
640 KB |
Output is correct |
13 |
Correct |
1 ms |
512 KB |
Output is correct |
14 |
Correct |
1 ms |
512 KB |
Output is correct |
15 |
Correct |
2 ms |
512 KB |
Output is correct |
16 |
Correct |
1 ms |
512 KB |
Output is correct |
17 |
Correct |
1 ms |
512 KB |
Output is correct |
18 |
Correct |
1 ms |
512 KB |
Output is correct |
19 |
Correct |
1 ms |
640 KB |
Output is correct |
20 |
Correct |
1 ms |
640 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
172 ms |
27428 KB |
Output is correct |
2 |
Correct |
185 ms |
27428 KB |
Output is correct |
3 |
Correct |
175 ms |
27428 KB |
Output is correct |
4 |
Correct |
175 ms |
27428 KB |
Output is correct |
5 |
Correct |
174 ms |
27560 KB |
Output is correct |
6 |
Correct |
215 ms |
47100 KB |
Output is correct |
7 |
Correct |
200 ms |
34720 KB |
Output is correct |
8 |
Correct |
207 ms |
32940 KB |
Output is correct |
9 |
Correct |
195 ms |
31060 KB |
Output is correct |
10 |
Correct |
177 ms |
27392 KB |
Output is correct |
11 |
Correct |
181 ms |
27560 KB |
Output is correct |
12 |
Correct |
178 ms |
27424 KB |
Output is correct |
13 |
Correct |
194 ms |
27428 KB |
Output is correct |
14 |
Correct |
170 ms |
25636 KB |
Output is correct |
15 |
Correct |
151 ms |
24352 KB |
Output is correct |
16 |
Correct |
94 ms |
20392 KB |
Output is correct |
17 |
Correct |
104 ms |
26392 KB |
Output is correct |
18 |
Correct |
107 ms |
26396 KB |
Output is correct |
19 |
Correct |
103 ms |
26532 KB |
Output is correct |
20 |
Correct |
106 ms |
26276 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
2 ms |
640 KB |
Output is correct |
2 |
Correct |
2 ms |
640 KB |
Output is correct |
3 |
Correct |
2 ms |
640 KB |
Output is correct |
4 |
Correct |
2 ms |
512 KB |
Output is correct |
5 |
Correct |
2 ms |
512 KB |
Output is correct |
6 |
Correct |
1 ms |
512 KB |
Output is correct |
7 |
Correct |
1 ms |
512 KB |
Output is correct |
8 |
Correct |
1 ms |
512 KB |
Output is correct |
9 |
Correct |
1 ms |
512 KB |
Output is correct |
10 |
Correct |
1 ms |
512 KB |
Output is correct |
11 |
Correct |
1 ms |
512 KB |
Output is correct |
12 |
Correct |
2 ms |
640 KB |
Output is correct |
13 |
Correct |
2 ms |
640 KB |
Output is correct |
14 |
Correct |
2 ms |
672 KB |
Output is correct |
15 |
Correct |
2 ms |
640 KB |
Output is correct |
16 |
Correct |
2 ms |
512 KB |
Output is correct |
17 |
Correct |
2 ms |
512 KB |
Output is correct |
18 |
Correct |
1 ms |
512 KB |
Output is correct |
19 |
Correct |
2 ms |
512 KB |
Output is correct |
20 |
Correct |
1 ms |
512 KB |
Output is correct |
21 |
Correct |
2 ms |
512 KB |
Output is correct |
22 |
Correct |
2 ms |
512 KB |
Output is correct |
23 |
Correct |
1 ms |
512 KB |
Output is correct |
24 |
Correct |
2 ms |
512 KB |
Output is correct |
25 |
Correct |
1 ms |
512 KB |
Output is correct |
26 |
Correct |
1 ms |
512 KB |
Output is correct |
27 |
Correct |
1 ms |
512 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
182 ms |
27424 KB |
Output is correct |
2 |
Correct |
191 ms |
27688 KB |
Output is correct |
3 |
Correct |
188 ms |
25888 KB |
Output is correct |
4 |
Correct |
182 ms |
22688 KB |
Output is correct |
5 |
Correct |
150 ms |
18848 KB |
Output is correct |
6 |
Correct |
144 ms |
17312 KB |
Output is correct |
7 |
Correct |
133 ms |
16420 KB |
Output is correct |
8 |
Correct |
124 ms |
15488 KB |
Output is correct |
9 |
Correct |
121 ms |
15212 KB |
Output is correct |
10 |
Correct |
114 ms |
15256 KB |
Output is correct |
11 |
Correct |
124 ms |
15084 KB |
Output is correct |
12 |
Correct |
107 ms |
14956 KB |
Output is correct |
13 |
Correct |
112 ms |
15084 KB |
Output is correct |
14 |
Correct |
115 ms |
17188 KB |
Output is correct |
15 |
Correct |
212 ms |
33316 KB |
Output is correct |
16 |
Correct |
207 ms |
30756 KB |
Output is correct |
17 |
Correct |
202 ms |
30372 KB |
Output is correct |
18 |
Correct |
200 ms |
28324 KB |
Output is correct |
19 |
Correct |
183 ms |
22828 KB |
Output is correct |
20 |
Correct |
178 ms |
22692 KB |
Output is correct |
21 |
Correct |
182 ms |
22764 KB |
Output is correct |
22 |
Correct |
166 ms |
20644 KB |
Output is correct |
23 |
Correct |
135 ms |
18724 KB |
Output is correct |
24 |
Correct |
157 ms |
25376 KB |
Output is correct |
25 |
Correct |
173 ms |
25504 KB |
Output is correct |
26 |
Correct |
151 ms |
23584 KB |
Output is correct |
27 |
Correct |
158 ms |
23588 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
256 KB |
Output is correct |
2 |
Correct |
1 ms |
256 KB |
Output is correct |
3 |
Correct |
1 ms |
256 KB |
Output is correct |
4 |
Correct |
1 ms |
256 KB |
Output is correct |
5 |
Correct |
1 ms |
256 KB |
Output is correct |
6 |
Correct |
1 ms |
256 KB |
Output is correct |
7 |
Correct |
1 ms |
256 KB |
Output is correct |
8 |
Correct |
0 ms |
256 KB |
Output is correct |
9 |
Correct |
0 ms |
256 KB |
Output is correct |
10 |
Correct |
1 ms |
256 KB |
Output is correct |
11 |
Correct |
1 ms |
256 KB |
Output is correct |
12 |
Correct |
1 ms |
256 KB |
Output is correct |
13 |
Correct |
1 ms |
256 KB |
Output is correct |
14 |
Correct |
0 ms |
256 KB |
Output is correct |
15 |
Correct |
0 ms |
256 KB |
Output is correct |
16 |
Correct |
1 ms |
256 KB |
Output is correct |
17 |
Correct |
1 ms |
384 KB |
Output is correct |
18 |
Correct |
0 ms |
256 KB |
Output is correct |
19 |
Correct |
1 ms |
256 KB |
Output is correct |
20 |
Correct |
1 ms |
256 KB |
Output is correct |
21 |
Correct |
1 ms |
256 KB |
Output is correct |
22 |
Correct |
1 ms |
256 KB |
Output is correct |
23 |
Correct |
0 ms |
256 KB |
Output is correct |
24 |
Correct |
1 ms |
384 KB |
Output is correct |
25 |
Correct |
1 ms |
384 KB |
Output is correct |
26 |
Correct |
1 ms |
256 KB |
Output is correct |
27 |
Correct |
1 ms |
256 KB |
Output is correct |
28 |
Correct |
0 ms |
256 KB |
Output is correct |
29 |
Correct |
1 ms |
256 KB |
Output is correct |
30 |
Correct |
0 ms |
384 KB |
Output is correct |
31 |
Correct |
1 ms |
256 KB |
Output is correct |
32 |
Correct |
1 ms |
256 KB |
Output is correct |
33 |
Correct |
1 ms |
256 KB |
Output is correct |
34 |
Correct |
0 ms |
256 KB |
Output is correct |
35 |
Correct |
1 ms |
384 KB |
Output is correct |
36 |
Correct |
1 ms |
384 KB |
Output is correct |
37 |
Correct |
1 ms |
384 KB |
Output is correct |
38 |
Correct |
1 ms |
384 KB |
Output is correct |
39 |
Correct |
1 ms |
384 KB |
Output is correct |
40 |
Correct |
1 ms |
384 KB |
Output is correct |
41 |
Correct |
1 ms |
384 KB |
Output is correct |
42 |
Correct |
1 ms |
384 KB |
Output is correct |
43 |
Correct |
0 ms |
384 KB |
Output is correct |
44 |
Correct |
1 ms |
384 KB |
Output is correct |
45 |
Correct |
1 ms |
256 KB |
Output is correct |
46 |
Correct |
1 ms |
384 KB |
Output is correct |
47 |
Correct |
0 ms |
384 KB |
Output is correct |
48 |
Correct |
1 ms |
384 KB |
Output is correct |
49 |
Correct |
0 ms |
384 KB |
Output is correct |
50 |
Correct |
1 ms |
384 KB |
Output is correct |
51 |
Correct |
1 ms |
384 KB |
Output is correct |
52 |
Correct |
1 ms |
384 KB |
Output is correct |
53 |
Correct |
1 ms |
384 KB |
Output is correct |
54 |
Correct |
1 ms |
256 KB |
Output is correct |
55 |
Correct |
0 ms |
384 KB |
Output is correct |
56 |
Correct |
1 ms |
384 KB |
Output is correct |
57 |
Correct |
1 ms |
384 KB |
Output is correct |
58 |
Correct |
1 ms |
384 KB |
Output is correct |
59 |
Correct |
1 ms |
384 KB |
Output is correct |
60 |
Correct |
1 ms |
384 KB |
Output is correct |
61 |
Correct |
1 ms |
384 KB |
Output is correct |
62 |
Correct |
1 ms |
384 KB |
Output is correct |
63 |
Correct |
1 ms |
384 KB |
Output is correct |
64 |
Correct |
1 ms |
384 KB |
Output is correct |
65 |
Correct |
1 ms |
384 KB |
Output is correct |
66 |
Correct |
1 ms |
512 KB |
Output is correct |
67 |
Correct |
2 ms |
512 KB |
Output is correct |
68 |
Correct |
1 ms |
512 KB |
Output is correct |
69 |
Correct |
2 ms |
640 KB |
Output is correct |
70 |
Correct |
2 ms |
672 KB |
Output is correct |
71 |
Correct |
2 ms |
512 KB |
Output is correct |
72 |
Correct |
1 ms |
512 KB |
Output is correct |
73 |
Correct |
1 ms |
512 KB |
Output is correct |
74 |
Correct |
1 ms |
512 KB |
Output is correct |
75 |
Correct |
1 ms |
512 KB |
Output is correct |
76 |
Correct |
1 ms |
384 KB |
Output is correct |
77 |
Correct |
2 ms |
512 KB |
Output is correct |
78 |
Correct |
2 ms |
512 KB |
Output is correct |
79 |
Correct |
1 ms |
512 KB |
Output is correct |
80 |
Correct |
1 ms |
512 KB |
Output is correct |
81 |
Correct |
1 ms |
512 KB |
Output is correct |
82 |
Correct |
1 ms |
512 KB |
Output is correct |
83 |
Correct |
1 ms |
640 KB |
Output is correct |
84 |
Correct |
2 ms |
512 KB |
Output is correct |
85 |
Correct |
2 ms |
512 KB |
Output is correct |
86 |
Correct |
2 ms |
512 KB |
Output is correct |
87 |
Correct |
2 ms |
512 KB |
Output is correct |
88 |
Correct |
1 ms |
512 KB |
Output is correct |
89 |
Correct |
1 ms |
512 KB |
Output is correct |
90 |
Correct |
1 ms |
512 KB |
Output is correct |
91 |
Correct |
1 ms |
512 KB |
Output is correct |
92 |
Correct |
2 ms |
512 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
256 KB |
Output is correct |
2 |
Correct |
1 ms |
256 KB |
Output is correct |
3 |
Correct |
1 ms |
256 KB |
Output is correct |
4 |
Correct |
1 ms |
256 KB |
Output is correct |
5 |
Correct |
1 ms |
256 KB |
Output is correct |
6 |
Correct |
1 ms |
256 KB |
Output is correct |
7 |
Correct |
1 ms |
256 KB |
Output is correct |
8 |
Correct |
0 ms |
256 KB |
Output is correct |
9 |
Correct |
0 ms |
256 KB |
Output is correct |
10 |
Correct |
1 ms |
256 KB |
Output is correct |
11 |
Correct |
1 ms |
256 KB |
Output is correct |
12 |
Correct |
1 ms |
256 KB |
Output is correct |
13 |
Correct |
1 ms |
256 KB |
Output is correct |
14 |
Correct |
0 ms |
256 KB |
Output is correct |
15 |
Correct |
0 ms |
256 KB |
Output is correct |
16 |
Correct |
1 ms |
256 KB |
Output is correct |
17 |
Correct |
1 ms |
384 KB |
Output is correct |
18 |
Correct |
0 ms |
256 KB |
Output is correct |
19 |
Correct |
1 ms |
256 KB |
Output is correct |
20 |
Correct |
1 ms |
256 KB |
Output is correct |
21 |
Correct |
1 ms |
256 KB |
Output is correct |
22 |
Correct |
1 ms |
256 KB |
Output is correct |
23 |
Correct |
0 ms |
256 KB |
Output is correct |
24 |
Correct |
1 ms |
384 KB |
Output is correct |
25 |
Correct |
1 ms |
384 KB |
Output is correct |
26 |
Correct |
1 ms |
256 KB |
Output is correct |
27 |
Correct |
1 ms |
256 KB |
Output is correct |
28 |
Correct |
0 ms |
256 KB |
Output is correct |
29 |
Correct |
1 ms |
256 KB |
Output is correct |
30 |
Correct |
0 ms |
384 KB |
Output is correct |
31 |
Correct |
1 ms |
256 KB |
Output is correct |
32 |
Correct |
1 ms |
256 KB |
Output is correct |
33 |
Correct |
1 ms |
256 KB |
Output is correct |
34 |
Correct |
0 ms |
256 KB |
Output is correct |
35 |
Correct |
1 ms |
384 KB |
Output is correct |
36 |
Correct |
1 ms |
384 KB |
Output is correct |
37 |
Correct |
1 ms |
384 KB |
Output is correct |
38 |
Correct |
1 ms |
384 KB |
Output is correct |
39 |
Correct |
1 ms |
384 KB |
Output is correct |
40 |
Correct |
1 ms |
384 KB |
Output is correct |
41 |
Correct |
1 ms |
384 KB |
Output is correct |
42 |
Correct |
1 ms |
384 KB |
Output is correct |
43 |
Correct |
0 ms |
384 KB |
Output is correct |
44 |
Correct |
1 ms |
384 KB |
Output is correct |
45 |
Correct |
1 ms |
256 KB |
Output is correct |
46 |
Correct |
1 ms |
384 KB |
Output is correct |
47 |
Correct |
0 ms |
384 KB |
Output is correct |
48 |
Correct |
1 ms |
384 KB |
Output is correct |
49 |
Correct |
0 ms |
384 KB |
Output is correct |
50 |
Correct |
1 ms |
384 KB |
Output is correct |
51 |
Correct |
1 ms |
384 KB |
Output is correct |
52 |
Correct |
1 ms |
384 KB |
Output is correct |
53 |
Correct |
1 ms |
384 KB |
Output is correct |
54 |
Correct |
1 ms |
256 KB |
Output is correct |
55 |
Correct |
0 ms |
384 KB |
Output is correct |
56 |
Correct |
1 ms |
384 KB |
Output is correct |
57 |
Correct |
1 ms |
384 KB |
Output is correct |
58 |
Correct |
1 ms |
384 KB |
Output is correct |
59 |
Correct |
1 ms |
384 KB |
Output is correct |
60 |
Correct |
1 ms |
384 KB |
Output is correct |
61 |
Correct |
1 ms |
384 KB |
Output is correct |
62 |
Correct |
1 ms |
384 KB |
Output is correct |
63 |
Correct |
1 ms |
384 KB |
Output is correct |
64 |
Correct |
1 ms |
384 KB |
Output is correct |
65 |
Correct |
1 ms |
384 KB |
Output is correct |
66 |
Correct |
145 ms |
29408 KB |
Output is correct |
67 |
Correct |
134 ms |
29404 KB |
Output is correct |
68 |
Correct |
207 ms |
30056 KB |
Output is correct |
69 |
Correct |
159 ms |
29324 KB |
Output is correct |
70 |
Correct |
179 ms |
24460 KB |
Output is correct |
71 |
Correct |
182 ms |
32160 KB |
Output is correct |
72 |
Correct |
182 ms |
26532 KB |
Output is correct |
73 |
Correct |
172 ms |
29604 KB |
Output is correct |
74 |
Correct |
170 ms |
24228 KB |
Output is correct |
75 |
Correct |
158 ms |
23840 KB |
Output is correct |
76 |
Correct |
132 ms |
18980 KB |
Output is correct |
77 |
Correct |
126 ms |
19012 KB |
Output is correct |
78 |
Correct |
119 ms |
18340 KB |
Output is correct |
79 |
Correct |
114 ms |
18340 KB |
Output is correct |
80 |
Correct |
88 ms |
17064 KB |
Output is correct |
81 |
Correct |
92 ms |
17192 KB |
Output is correct |
82 |
Correct |
21 ms |
16824 KB |
Output is correct |
83 |
Correct |
20 ms |
16824 KB |
Output is correct |
84 |
Correct |
20 ms |
16824 KB |
Output is correct |
85 |
Correct |
19 ms |
16824 KB |
Output is correct |
86 |
Correct |
20 ms |
16824 KB |
Output is correct |
87 |
Correct |
20 ms |
16824 KB |
Output is correct |
88 |
Correct |
2 ms |
640 KB |
Output is correct |
89 |
Correct |
2 ms |
640 KB |
Output is correct |
90 |
Correct |
2 ms |
640 KB |
Output is correct |
91 |
Correct |
2 ms |
768 KB |
Output is correct |
92 |
Correct |
2 ms |
640 KB |
Output is correct |
93 |
Correct |
2 ms |
640 KB |
Output is correct |
94 |
Correct |
2 ms |
768 KB |
Output is correct |
95 |
Correct |
2 ms |
640 KB |
Output is correct |
96 |
Correct |
2 ms |
640 KB |
Output is correct |
97 |
Correct |
2 ms |
640 KB |
Output is correct |
98 |
Correct |
2 ms |
640 KB |
Output is correct |
99 |
Correct |
2 ms |
640 KB |
Output is correct |
100 |
Correct |
1 ms |
512 KB |
Output is correct |
101 |
Correct |
1 ms |
512 KB |
Output is correct |
102 |
Correct |
2 ms |
512 KB |
Output is correct |
103 |
Correct |
1 ms |
512 KB |
Output is correct |
104 |
Correct |
1 ms |
512 KB |
Output is correct |
105 |
Correct |
1 ms |
512 KB |
Output is correct |
106 |
Correct |
1 ms |
640 KB |
Output is correct |
107 |
Correct |
1 ms |
640 KB |
Output is correct |
108 |
Correct |
172 ms |
27428 KB |
Output is correct |
109 |
Correct |
185 ms |
27428 KB |
Output is correct |
110 |
Correct |
175 ms |
27428 KB |
Output is correct |
111 |
Correct |
175 ms |
27428 KB |
Output is correct |
112 |
Correct |
174 ms |
27560 KB |
Output is correct |
113 |
Correct |
215 ms |
47100 KB |
Output is correct |
114 |
Correct |
200 ms |
34720 KB |
Output is correct |
115 |
Correct |
207 ms |
32940 KB |
Output is correct |
116 |
Correct |
195 ms |
31060 KB |
Output is correct |
117 |
Correct |
177 ms |
27392 KB |
Output is correct |
118 |
Correct |
181 ms |
27560 KB |
Output is correct |
119 |
Correct |
178 ms |
27424 KB |
Output is correct |
120 |
Correct |
194 ms |
27428 KB |
Output is correct |
121 |
Correct |
170 ms |
25636 KB |
Output is correct |
122 |
Correct |
151 ms |
24352 KB |
Output is correct |
123 |
Correct |
94 ms |
20392 KB |
Output is correct |
124 |
Correct |
104 ms |
26392 KB |
Output is correct |
125 |
Correct |
107 ms |
26396 KB |
Output is correct |
126 |
Correct |
103 ms |
26532 KB |
Output is correct |
127 |
Correct |
106 ms |
26276 KB |
Output is correct |
128 |
Correct |
2 ms |
640 KB |
Output is correct |
129 |
Correct |
2 ms |
640 KB |
Output is correct |
130 |
Correct |
2 ms |
640 KB |
Output is correct |
131 |
Correct |
2 ms |
512 KB |
Output is correct |
132 |
Correct |
2 ms |
512 KB |
Output is correct |
133 |
Correct |
1 ms |
512 KB |
Output is correct |
134 |
Correct |
1 ms |
512 KB |
Output is correct |
135 |
Correct |
1 ms |
512 KB |
Output is correct |
136 |
Correct |
1 ms |
512 KB |
Output is correct |
137 |
Correct |
1 ms |
512 KB |
Output is correct |
138 |
Correct |
1 ms |
512 KB |
Output is correct |
139 |
Correct |
2 ms |
640 KB |
Output is correct |
140 |
Correct |
2 ms |
640 KB |
Output is correct |
141 |
Correct |
2 ms |
672 KB |
Output is correct |
142 |
Correct |
2 ms |
640 KB |
Output is correct |
143 |
Correct |
2 ms |
512 KB |
Output is correct |
144 |
Correct |
2 ms |
512 KB |
Output is correct |
145 |
Correct |
1 ms |
512 KB |
Output is correct |
146 |
Correct |
2 ms |
512 KB |
Output is correct |
147 |
Correct |
1 ms |
512 KB |
Output is correct |
148 |
Correct |
2 ms |
512 KB |
Output is correct |
149 |
Correct |
2 ms |
512 KB |
Output is correct |
150 |
Correct |
1 ms |
512 KB |
Output is correct |
151 |
Correct |
2 ms |
512 KB |
Output is correct |
152 |
Correct |
1 ms |
512 KB |
Output is correct |
153 |
Correct |
1 ms |
512 KB |
Output is correct |
154 |
Correct |
1 ms |
512 KB |
Output is correct |
155 |
Correct |
182 ms |
27424 KB |
Output is correct |
156 |
Correct |
191 ms |
27688 KB |
Output is correct |
157 |
Correct |
188 ms |
25888 KB |
Output is correct |
158 |
Correct |
182 ms |
22688 KB |
Output is correct |
159 |
Correct |
150 ms |
18848 KB |
Output is correct |
160 |
Correct |
144 ms |
17312 KB |
Output is correct |
161 |
Correct |
133 ms |
16420 KB |
Output is correct |
162 |
Correct |
124 ms |
15488 KB |
Output is correct |
163 |
Correct |
121 ms |
15212 KB |
Output is correct |
164 |
Correct |
114 ms |
15256 KB |
Output is correct |
165 |
Correct |
124 ms |
15084 KB |
Output is correct |
166 |
Correct |
107 ms |
14956 KB |
Output is correct |
167 |
Correct |
112 ms |
15084 KB |
Output is correct |
168 |
Correct |
115 ms |
17188 KB |
Output is correct |
169 |
Correct |
212 ms |
33316 KB |
Output is correct |
170 |
Correct |
207 ms |
30756 KB |
Output is correct |
171 |
Correct |
202 ms |
30372 KB |
Output is correct |
172 |
Correct |
200 ms |
28324 KB |
Output is correct |
173 |
Correct |
183 ms |
22828 KB |
Output is correct |
174 |
Correct |
178 ms |
22692 KB |
Output is correct |
175 |
Correct |
182 ms |
22764 KB |
Output is correct |
176 |
Correct |
166 ms |
20644 KB |
Output is correct |
177 |
Correct |
135 ms |
18724 KB |
Output is correct |
178 |
Correct |
157 ms |
25376 KB |
Output is correct |
179 |
Correct |
173 ms |
25504 KB |
Output is correct |
180 |
Correct |
151 ms |
23584 KB |
Output is correct |
181 |
Correct |
158 ms |
23588 KB |
Output is correct |
182 |
Correct |
1 ms |
512 KB |
Output is correct |
183 |
Correct |
2 ms |
512 KB |
Output is correct |
184 |
Correct |
1 ms |
512 KB |
Output is correct |
185 |
Correct |
2 ms |
640 KB |
Output is correct |
186 |
Correct |
2 ms |
672 KB |
Output is correct |
187 |
Correct |
2 ms |
512 KB |
Output is correct |
188 |
Correct |
1 ms |
512 KB |
Output is correct |
189 |
Correct |
1 ms |
512 KB |
Output is correct |
190 |
Correct |
1 ms |
512 KB |
Output is correct |
191 |
Correct |
1 ms |
512 KB |
Output is correct |
192 |
Correct |
1 ms |
384 KB |
Output is correct |
193 |
Correct |
2 ms |
512 KB |
Output is correct |
194 |
Correct |
2 ms |
512 KB |
Output is correct |
195 |
Correct |
1 ms |
512 KB |
Output is correct |
196 |
Correct |
1 ms |
512 KB |
Output is correct |
197 |
Correct |
1 ms |
512 KB |
Output is correct |
198 |
Correct |
1 ms |
512 KB |
Output is correct |
199 |
Correct |
1 ms |
640 KB |
Output is correct |
200 |
Correct |
2 ms |
512 KB |
Output is correct |
201 |
Correct |
2 ms |
512 KB |
Output is correct |
202 |
Correct |
2 ms |
512 KB |
Output is correct |
203 |
Correct |
2 ms |
512 KB |
Output is correct |
204 |
Correct |
1 ms |
512 KB |
Output is correct |
205 |
Correct |
1 ms |
512 KB |
Output is correct |
206 |
Correct |
1 ms |
512 KB |
Output is correct |
207 |
Correct |
1 ms |
512 KB |
Output is correct |
208 |
Correct |
2 ms |
512 KB |
Output is correct |
209 |
Correct |
21 ms |
16824 KB |
Output is correct |
210 |
Correct |
95 ms |
21160 KB |
Output is correct |
211 |
Correct |
147 ms |
23716 KB |
Output is correct |
212 |
Correct |
195 ms |
28456 KB |
Output is correct |
213 |
Correct |
227 ms |
31896 KB |
Output is correct |
214 |
Correct |
87 ms |
19352 KB |
Output is correct |
215 |
Correct |
91 ms |
18208 KB |
Output is correct |
216 |
Correct |
173 ms |
23744 KB |
Output is correct |
217 |
Correct |
160 ms |
19872 KB |
Output is correct |
218 |
Correct |
129 ms |
15524 KB |
Output is correct |
219 |
Correct |
121 ms |
15292 KB |
Output is correct |
220 |
Correct |
116 ms |
15212 KB |
Output is correct |
221 |
Correct |
107 ms |
15084 KB |
Output is correct |
222 |
Correct |
106 ms |
16364 KB |
Output is correct |
223 |
Correct |
180 ms |
23960 KB |
Output is correct |
224 |
Correct |
176 ms |
22684 KB |
Output is correct |
225 |
Correct |
163 ms |
18972 KB |
Output is correct |
226 |
Correct |
159 ms |
18976 KB |
Output is correct |
227 |
Correct |
165 ms |
19588 KB |
Output is correct |
228 |
Correct |
160 ms |
17740 KB |
Output is correct |
229 |
Correct |
130 ms |
16088 KB |
Output is correct |
230 |
Correct |
142 ms |
19352 KB |
Output is correct |
231 |
Correct |
135 ms |
19356 KB |
Output is correct |