//#include "jump.h"
#include <bits/stdc++.h>
#include <vector>
using namespace std;
int n, par[ 200001 ][ 21 ], parr[ 200001 ][ 21 ], dist[ 200001 ][ 21 ], distt[ 200001 ][ 21 ];
int lg = 20;
int a[ 200001 ], l[ 200001 ], r[ 200001 ], sum = 0;
vector <int> v[ 200001 ], vv;
vector <pair<int, int> > v1;
bool ok;
void init(int N, vector<int> H) {
n = N;
for ( int i = 0 ; i < H.size(); i ++ ) {
a[ i + 1 ] = H[ i ];
v1.push_back( { a[ i + 1 ], i + 1 } );
}
sort( v1.begin(), v1.end() );
for ( int i = 1; i <= n; i ++ ) {
while ( vv.size() && a[ vv.back() ] < a[ i ] ) {
vv.pop_back();
}
if ( vv.size() ) {
v[ i ].push_back( vv.back() );
}
vv.push_back( i );
}
vv.clear();
for ( int i = n; i >= 1; i -- ) {
while ( vv.size() && a[ vv.back() ] < a[ i ] ) {
vv.pop_back();
}
if ( vv.size() )
v[ i ].push_back( vv.back() );
vv.push_back( i );
}
for ( int i = 1; i <= n; i ++ ) {
if ( v[ i ].size() == 1 ) {
parr[ i ][ 0 ] = v[ i ].back();
par[ i ][ 0 ] = i;
dist[ i ][ 0 ] = 0;
distt[ i ][ 0 ] = 1;
}
else if ( v[ i ].size() == 2 ) {
if ( a[ v[ i ].back() ] > a[ v[ i ].front() ] ) {
par[ i ][ 0 ] = v[ i ].back();
parr[ i ][ 0 ] = v[ i ].front();
}
else {
par[ i ][ 0 ] = v[ i ].front();
parr[ i ][ 0 ] = v[ i ].back();
}
dist[ i][ 0 ] = distt[ i ][ 0 ] = 1;
}
else {
par[ i ][ 0 ] = parr[ i ][ 0 ] = i;
dist[ i ][ 0 ] = distt[ i ][ 0 ] = 0;
}
}
for ( int i = v1.size() - 1; i >= 0; i -- ) {
for ( int j = 1; j <= lg; j ++ ) {
par[ v1[ i ].second ][ j ] = par[ par[ v1[ i ].second ][ j - 1 ]][ j - 1 ];
dist[ v1[ i ].second ][ j ] = dist[ par[ v1[ i ].second ][ j - 1 ] ][ j - 1 ] + dist[ v1[ i ].second ][ j - 1 ];
parr[ v1[ i ].second ][ j ] = parr[ parr[ v1[ i ].second ][ j - 1 ] ][ j - 1 ];
distt[ v1[ i ].second ][ j ] = distt[ parr[ v1[ i ].second ][ j - 1 ] ][ j - 1 ] + distt[ v1[ i ].second ][ j - 1 ];
}
}
for ( int i = n; i > 1; i -- ) {
if ( a[ i ] <= a[ i - 1 ] )
ok = 1;
}
}
const long long oo = 1e18;
long long mx, mn;
int c, f;
map <int, long long> d;
map <int, bool> used;
queue <int> q;
long long int bfs() {
mx = oo;
while ( q.size() ) {
int g = q.front();
q.pop();
for ( auto to : v[ g ] ) {
if ( !used[ to ] || d[ to ] > d[ g ] + 1 ) {
d[ to ] = d[ g ] + 1;
q.push( to );
if ( to >= c && to <= f ) {
mx = min( d[ g ] + 1, mx );
}
used[ to ] = 1;
}
}
}
while( q.size() )
q.pop();
return mx;
}
pair<int,int> lca( int aa, int b ) {
int sum = 0;
if ( aa == b )
return { aa, 0 };
for ( int i = lg; i >= 0; i -- ) {
if ( a[ par[ aa ][ i ] ] <= a[ b ] ) {
sum += dist[ aa ][ i ];
aa = par[ aa ][ i ];
}
}
return { aa, sum };
}
pair<int,int> lca1( int aa, int b ) {
if ( aa == b )
return { aa, 0 };
int sum = 0;
for ( int i = lg; i >= 0; i -- ) {
if ( a[ parr[ aa ][ i ] ] < a[ b ] ) {
sum += distt[ aa ][ i ];
aa = parr[ aa ][ i ];
}
}
return { parr[ aa ][ 0 ], sum + distt[ aa ][ 0 ] };
}
int minimum_jumps(int A, int B, int C, int D) {
A ++;
B ++;
C ++;
D ++;
if ( !ok ) {
if ( C > B )
return C - B;
else
return A - D;
}
if ( A == B && C == D ) {
pair<int, int> p;
p = lca( A, C );
sum = p.second;
p = lca1( p.first, C );
if ( p.first == C )
return sum + p.second;
return -1;
}
d.clear();
used.clear();
c = C;
f = D;
mn = oo;
for ( int i = A; i <= B; i ++ ) {
q.push( i );
used[ i ] = 1;
}
mn = bfs( );
if ( mn == oo )
return -1;
return mn;
}
//int main () {
// int n;
// cin >> n;
// int a;
// vector <int> v;
// v.clear();
// for ( int i = 1; i <= n; i ++ )
// cin >> a, v.push_back( a );
// init( n, v );
// int m, a, b, c, d;
// cin >> m;
// while ( m -- ) {
// cin >> a >> b >> c >> d;
//
// }
//}
Compilation message
jumps.cpp: In function 'void init(int, std::vector<int>)':
jumps.cpp:17:22: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
17 | for ( int i = 0 ; i < H.size(); i ++ ) {
| ~~^~~~~~~~~~
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
3 ms |
4988 KB |
Output is correct |
2 |
Correct |
3 ms |
4936 KB |
Output is correct |
3 |
Correct |
193 ms |
66024 KB |
Output is correct |
4 |
Correct |
1073 ms |
81764 KB |
Output is correct |
5 |
Correct |
802 ms |
43624 KB |
Output is correct |
6 |
Correct |
1062 ms |
81712 KB |
Output is correct |
7 |
Correct |
745 ms |
57732 KB |
Output is correct |
8 |
Correct |
1078 ms |
81640 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
4936 KB |
Output is correct |
2 |
Correct |
3 ms |
4936 KB |
Output is correct |
3 |
Correct |
3 ms |
4936 KB |
Output is correct |
4 |
Correct |
3 ms |
4936 KB |
Output is correct |
5 |
Correct |
4 ms |
5040 KB |
Output is correct |
6 |
Correct |
10 ms |
5064 KB |
Output is correct |
7 |
Correct |
7 ms |
5104 KB |
Output is correct |
8 |
Correct |
12 ms |
5116 KB |
Output is correct |
9 |
Correct |
6 ms |
5064 KB |
Output is correct |
10 |
Correct |
9 ms |
5064 KB |
Output is correct |
11 |
Correct |
5 ms |
5064 KB |
Output is correct |
12 |
Correct |
9 ms |
5120 KB |
Output is correct |
13 |
Correct |
9 ms |
5064 KB |
Output is correct |
14 |
Correct |
9 ms |
5064 KB |
Output is correct |
15 |
Correct |
14 ms |
5116 KB |
Output is correct |
16 |
Correct |
11 ms |
5064 KB |
Output is correct |
17 |
Correct |
10 ms |
5064 KB |
Output is correct |
18 |
Correct |
3 ms |
4936 KB |
Output is correct |
19 |
Correct |
3 ms |
4936 KB |
Output is correct |
20 |
Correct |
9 ms |
5064 KB |
Output is correct |
21 |
Correct |
8 ms |
5116 KB |
Output is correct |
22 |
Correct |
9 ms |
5132 KB |
Output is correct |
23 |
Correct |
15 ms |
5064 KB |
Output is correct |
24 |
Correct |
10 ms |
5064 KB |
Output is correct |
25 |
Correct |
3 ms |
4936 KB |
Output is correct |
26 |
Correct |
3 ms |
4936 KB |
Output is correct |
27 |
Correct |
4 ms |
4936 KB |
Output is correct |
28 |
Correct |
5 ms |
5064 KB |
Output is correct |
29 |
Correct |
5 ms |
5064 KB |
Output is correct |
30 |
Correct |
4 ms |
5064 KB |
Output is correct |
31 |
Correct |
4 ms |
5064 KB |
Output is correct |
32 |
Correct |
4 ms |
5032 KB |
Output is correct |
33 |
Correct |
3 ms |
4936 KB |
Output is correct |
34 |
Correct |
3 ms |
5064 KB |
Output is correct |
35 |
Correct |
3 ms |
5112 KB |
Output is correct |
36 |
Correct |
3 ms |
5112 KB |
Output is correct |
37 |
Correct |
3 ms |
5064 KB |
Output is correct |
38 |
Correct |
3 ms |
5064 KB |
Output is correct |
39 |
Correct |
3 ms |
5064 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
4936 KB |
Output is correct |
2 |
Correct |
3 ms |
4936 KB |
Output is correct |
3 |
Correct |
3 ms |
4936 KB |
Output is correct |
4 |
Correct |
3 ms |
4936 KB |
Output is correct |
5 |
Correct |
4 ms |
5040 KB |
Output is correct |
6 |
Correct |
10 ms |
5064 KB |
Output is correct |
7 |
Correct |
7 ms |
5104 KB |
Output is correct |
8 |
Correct |
12 ms |
5116 KB |
Output is correct |
9 |
Correct |
6 ms |
5064 KB |
Output is correct |
10 |
Correct |
9 ms |
5064 KB |
Output is correct |
11 |
Correct |
5 ms |
5064 KB |
Output is correct |
12 |
Correct |
9 ms |
5120 KB |
Output is correct |
13 |
Correct |
9 ms |
5064 KB |
Output is correct |
14 |
Correct |
9 ms |
5064 KB |
Output is correct |
15 |
Correct |
14 ms |
5116 KB |
Output is correct |
16 |
Correct |
11 ms |
5064 KB |
Output is correct |
17 |
Correct |
10 ms |
5064 KB |
Output is correct |
18 |
Correct |
3 ms |
4936 KB |
Output is correct |
19 |
Correct |
3 ms |
4936 KB |
Output is correct |
20 |
Correct |
9 ms |
5064 KB |
Output is correct |
21 |
Correct |
8 ms |
5116 KB |
Output is correct |
22 |
Correct |
9 ms |
5132 KB |
Output is correct |
23 |
Correct |
15 ms |
5064 KB |
Output is correct |
24 |
Correct |
10 ms |
5064 KB |
Output is correct |
25 |
Correct |
3 ms |
4936 KB |
Output is correct |
26 |
Correct |
3 ms |
4936 KB |
Output is correct |
27 |
Correct |
4 ms |
4936 KB |
Output is correct |
28 |
Correct |
5 ms |
5064 KB |
Output is correct |
29 |
Correct |
5 ms |
5064 KB |
Output is correct |
30 |
Correct |
4 ms |
5064 KB |
Output is correct |
31 |
Correct |
4 ms |
5064 KB |
Output is correct |
32 |
Correct |
4 ms |
5032 KB |
Output is correct |
33 |
Correct |
3 ms |
4936 KB |
Output is correct |
34 |
Correct |
3 ms |
5064 KB |
Output is correct |
35 |
Correct |
3 ms |
5112 KB |
Output is correct |
36 |
Correct |
3 ms |
5112 KB |
Output is correct |
37 |
Correct |
3 ms |
5064 KB |
Output is correct |
38 |
Correct |
3 ms |
5064 KB |
Output is correct |
39 |
Correct |
3 ms |
5064 KB |
Output is correct |
40 |
Correct |
3 ms |
4936 KB |
Output is correct |
41 |
Correct |
3 ms |
4936 KB |
Output is correct |
42 |
Correct |
3 ms |
4936 KB |
Output is correct |
43 |
Correct |
3 ms |
4936 KB |
Output is correct |
44 |
Correct |
6 ms |
4936 KB |
Output is correct |
45 |
Correct |
9 ms |
5004 KB |
Output is correct |
46 |
Correct |
7 ms |
5064 KB |
Output is correct |
47 |
Correct |
12 ms |
5036 KB |
Output is correct |
48 |
Correct |
5 ms |
5112 KB |
Output is correct |
49 |
Correct |
9 ms |
5116 KB |
Output is correct |
50 |
Correct |
5 ms |
5064 KB |
Output is correct |
51 |
Correct |
10 ms |
5064 KB |
Output is correct |
52 |
Correct |
10 ms |
5064 KB |
Output is correct |
53 |
Correct |
8 ms |
5064 KB |
Output is correct |
54 |
Correct |
15 ms |
5064 KB |
Output is correct |
55 |
Correct |
12 ms |
5064 KB |
Output is correct |
56 |
Correct |
10 ms |
5064 KB |
Output is correct |
57 |
Correct |
3 ms |
5080 KB |
Output is correct |
58 |
Correct |
285 ms |
5832 KB |
Output is correct |
59 |
Correct |
466 ms |
5960 KB |
Output is correct |
60 |
Correct |
50 ms |
5320 KB |
Output is correct |
61 |
Correct |
502 ms |
5980 KB |
Output is correct |
62 |
Correct |
62 ms |
5108 KB |
Output is correct |
63 |
Correct |
444 ms |
5988 KB |
Output is correct |
64 |
Correct |
23 ms |
5704 KB |
Output is correct |
65 |
Correct |
731 ms |
6020 KB |
Output is correct |
66 |
Correct |
795 ms |
6008 KB |
Output is correct |
67 |
Correct |
480 ms |
5984 KB |
Output is correct |
68 |
Correct |
1292 ms |
6008 KB |
Output is correct |
69 |
Correct |
944 ms |
6012 KB |
Output is correct |
70 |
Correct |
1189 ms |
5960 KB |
Output is correct |
71 |
Correct |
4 ms |
4936 KB |
Output is correct |
72 |
Correct |
5 ms |
5044 KB |
Output is correct |
73 |
Correct |
10 ms |
5064 KB |
Output is correct |
74 |
Correct |
10 ms |
5064 KB |
Output is correct |
75 |
Correct |
12 ms |
5124 KB |
Output is correct |
76 |
Correct |
21 ms |
5112 KB |
Output is correct |
77 |
Correct |
11 ms |
5064 KB |
Output is correct |
78 |
Correct |
3 ms |
4996 KB |
Output is correct |
79 |
Correct |
3 ms |
4936 KB |
Output is correct |
80 |
Correct |
5 ms |
4936 KB |
Output is correct |
81 |
Correct |
5 ms |
5064 KB |
Output is correct |
82 |
Correct |
4 ms |
5064 KB |
Output is correct |
83 |
Correct |
5 ms |
5064 KB |
Output is correct |
84 |
Correct |
5 ms |
5064 KB |
Output is correct |
85 |
Correct |
5 ms |
5064 KB |
Output is correct |
86 |
Correct |
4 ms |
4932 KB |
Output is correct |
87 |
Correct |
4 ms |
5064 KB |
Output is correct |
88 |
Correct |
4 ms |
5064 KB |
Output is correct |
89 |
Correct |
3 ms |
5064 KB |
Output is correct |
90 |
Correct |
3 ms |
5060 KB |
Output is correct |
91 |
Correct |
4 ms |
5024 KB |
Output is correct |
92 |
Correct |
3 ms |
5064 KB |
Output is correct |
93 |
Correct |
4 ms |
5076 KB |
Output is correct |
94 |
Correct |
15 ms |
5152 KB |
Output is correct |
95 |
Correct |
488 ms |
5980 KB |
Output is correct |
96 |
Correct |
601 ms |
6028 KB |
Output is correct |
97 |
Correct |
540 ms |
6080 KB |
Output is correct |
98 |
Correct |
1208 ms |
6148 KB |
Output is correct |
99 |
Correct |
505 ms |
6016 KB |
Output is correct |
100 |
Correct |
3 ms |
5064 KB |
Output is correct |
101 |
Correct |
4 ms |
5192 KB |
Output is correct |
102 |
Correct |
26 ms |
5764 KB |
Output is correct |
103 |
Correct |
24 ms |
5704 KB |
Output is correct |
104 |
Correct |
24 ms |
5704 KB |
Output is correct |
105 |
Correct |
26 ms |
5756 KB |
Output is correct |
106 |
Correct |
12 ms |
5704 KB |
Output is correct |
107 |
Correct |
3 ms |
5084 KB |
Output is correct |
108 |
Correct |
4 ms |
5356 KB |
Output is correct |
109 |
Correct |
6 ms |
5832 KB |
Output is correct |
110 |
Correct |
6 ms |
5960 KB |
Output is correct |
111 |
Correct |
6 ms |
5832 KB |
Output is correct |
112 |
Correct |
7 ms |
5960 KB |
Output is correct |
113 |
Correct |
8 ms |
5960 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
3 ms |
4936 KB |
Output is correct |
2 |
Correct |
3 ms |
4936 KB |
Output is correct |
3 |
Correct |
3 ms |
4936 KB |
Output is correct |
4 |
Correct |
3 ms |
4936 KB |
Output is correct |
5 |
Correct |
237 ms |
74356 KB |
Output is correct |
6 |
Correct |
334 ms |
87824 KB |
Output is correct |
7 |
Correct |
106 ms |
43904 KB |
Output is correct |
8 |
Correct |
385 ms |
101008 KB |
Output is correct |
9 |
Correct |
45 ms |
18244 KB |
Output is correct |
10 |
Correct |
260 ms |
86344 KB |
Output is correct |
11 |
Correct |
142 ms |
81712 KB |
Output is correct |
12 |
Correct |
674 ms |
101288 KB |
Output is correct |
13 |
Correct |
367 ms |
96876 KB |
Output is correct |
14 |
Correct |
266 ms |
85576 KB |
Output is correct |
15 |
Correct |
635 ms |
102424 KB |
Output is correct |
16 |
Correct |
481 ms |
102900 KB |
Output is correct |
17 |
Correct |
645 ms |
102860 KB |
Output is correct |
18 |
Correct |
3 ms |
4936 KB |
Output is correct |
19 |
Correct |
3 ms |
5064 KB |
Output is correct |
20 |
Correct |
3 ms |
5064 KB |
Output is correct |
21 |
Correct |
3 ms |
5064 KB |
Output is correct |
22 |
Correct |
3 ms |
5064 KB |
Output is correct |
23 |
Correct |
3 ms |
5064 KB |
Output is correct |
24 |
Correct |
3 ms |
5064 KB |
Output is correct |
25 |
Correct |
3 ms |
5064 KB |
Output is correct |
26 |
Correct |
4 ms |
5344 KB |
Output is correct |
27 |
Correct |
8 ms |
5832 KB |
Output is correct |
28 |
Correct |
6 ms |
5960 KB |
Output is correct |
29 |
Correct |
5 ms |
5832 KB |
Output is correct |
30 |
Correct |
7 ms |
5960 KB |
Output is correct |
31 |
Correct |
8 ms |
5960 KB |
Output is correct |
32 |
Correct |
3 ms |
4936 KB |
Output is correct |
33 |
Correct |
221 ms |
80768 KB |
Output is correct |
34 |
Correct |
283 ms |
88524 KB |
Output is correct |
35 |
Correct |
355 ms |
96412 KB |
Output is correct |
36 |
Correct |
247 ms |
83616 KB |
Output is correct |
37 |
Correct |
373 ms |
99692 KB |
Output is correct |
38 |
Correct |
313 ms |
102852 KB |
Output is correct |
39 |
Correct |
3 ms |
4936 KB |
Output is correct |
40 |
Correct |
129 ms |
48916 KB |
Output is correct |
41 |
Correct |
235 ms |
80888 KB |
Output is correct |
42 |
Correct |
142 ms |
81604 KB |
Output is correct |
43 |
Correct |
221 ms |
80900 KB |
Output is correct |
44 |
Correct |
199 ms |
81376 KB |
Output is correct |
45 |
Correct |
143 ms |
81636 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
3 ms |
4936 KB |
Output is correct |
2 |
Correct |
3 ms |
4936 KB |
Output is correct |
3 |
Correct |
3 ms |
4936 KB |
Output is correct |
4 |
Correct |
250 ms |
39740 KB |
Output is correct |
5 |
Correct |
1213 ms |
81000 KB |
Output is correct |
6 |
Correct |
673 ms |
17472 KB |
Output is correct |
7 |
Correct |
1066 ms |
80944 KB |
Output is correct |
8 |
Correct |
624 ms |
31172 KB |
Output is correct |
9 |
Correct |
1036 ms |
80944 KB |
Output is correct |
10 |
Correct |
984 ms |
81712 KB |
Output is correct |
11 |
Correct |
1234 ms |
82080 KB |
Output is correct |
12 |
Correct |
1018 ms |
81500 KB |
Output is correct |
13 |
Correct |
1085 ms |
80860 KB |
Output is correct |
14 |
Correct |
820 ms |
81200 KB |
Output is correct |
15 |
Correct |
1077 ms |
81712 KB |
Output is correct |
16 |
Correct |
1022 ms |
81640 KB |
Output is correct |
17 |
Correct |
3 ms |
4936 KB |
Output is correct |
18 |
Correct |
3 ms |
4936 KB |
Output is correct |
19 |
Correct |
4 ms |
4936 KB |
Output is correct |
20 |
Correct |
5 ms |
5064 KB |
Output is correct |
21 |
Correct |
5 ms |
5064 KB |
Output is correct |
22 |
Correct |
5 ms |
5064 KB |
Output is correct |
23 |
Correct |
5 ms |
5064 KB |
Output is correct |
24 |
Correct |
5 ms |
5008 KB |
Output is correct |
25 |
Correct |
3 ms |
5064 KB |
Output is correct |
26 |
Correct |
4 ms |
5316 KB |
Output is correct |
27 |
Correct |
15 ms |
5704 KB |
Output is correct |
28 |
Correct |
25 ms |
5704 KB |
Output is correct |
29 |
Correct |
23 ms |
5704 KB |
Output is correct |
30 |
Correct |
25 ms |
5704 KB |
Output is correct |
31 |
Correct |
18 ms |
5704 KB |
Output is correct |
32 |
Correct |
3 ms |
4936 KB |
Output is correct |
33 |
Correct |
122 ms |
48948 KB |
Output is correct |
34 |
Correct |
221 ms |
80888 KB |
Output is correct |
35 |
Correct |
141 ms |
81664 KB |
Output is correct |
36 |
Correct |
197 ms |
80864 KB |
Output is correct |
37 |
Correct |
199 ms |
81256 KB |
Output is correct |
38 |
Correct |
146 ms |
81764 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
3 ms |
4936 KB |
Output is correct |
2 |
Correct |
3 ms |
4936 KB |
Output is correct |
3 |
Correct |
3 ms |
4936 KB |
Output is correct |
4 |
Correct |
250 ms |
39740 KB |
Output is correct |
5 |
Correct |
1213 ms |
81000 KB |
Output is correct |
6 |
Correct |
673 ms |
17472 KB |
Output is correct |
7 |
Correct |
1066 ms |
80944 KB |
Output is correct |
8 |
Correct |
624 ms |
31172 KB |
Output is correct |
9 |
Correct |
1036 ms |
80944 KB |
Output is correct |
10 |
Correct |
984 ms |
81712 KB |
Output is correct |
11 |
Correct |
1234 ms |
82080 KB |
Output is correct |
12 |
Correct |
1018 ms |
81500 KB |
Output is correct |
13 |
Correct |
1085 ms |
80860 KB |
Output is correct |
14 |
Correct |
820 ms |
81200 KB |
Output is correct |
15 |
Correct |
1077 ms |
81712 KB |
Output is correct |
16 |
Correct |
1022 ms |
81640 KB |
Output is correct |
17 |
Correct |
3 ms |
4936 KB |
Output is correct |
18 |
Correct |
3 ms |
4936 KB |
Output is correct |
19 |
Correct |
4 ms |
4936 KB |
Output is correct |
20 |
Correct |
5 ms |
5064 KB |
Output is correct |
21 |
Correct |
5 ms |
5064 KB |
Output is correct |
22 |
Correct |
5 ms |
5064 KB |
Output is correct |
23 |
Correct |
5 ms |
5064 KB |
Output is correct |
24 |
Correct |
5 ms |
5008 KB |
Output is correct |
25 |
Correct |
3 ms |
5064 KB |
Output is correct |
26 |
Correct |
4 ms |
5316 KB |
Output is correct |
27 |
Correct |
15 ms |
5704 KB |
Output is correct |
28 |
Correct |
25 ms |
5704 KB |
Output is correct |
29 |
Correct |
23 ms |
5704 KB |
Output is correct |
30 |
Correct |
25 ms |
5704 KB |
Output is correct |
31 |
Correct |
18 ms |
5704 KB |
Output is correct |
32 |
Correct |
3 ms |
4936 KB |
Output is correct |
33 |
Correct |
122 ms |
48948 KB |
Output is correct |
34 |
Correct |
221 ms |
80888 KB |
Output is correct |
35 |
Correct |
141 ms |
81664 KB |
Output is correct |
36 |
Correct |
197 ms |
80864 KB |
Output is correct |
37 |
Correct |
199 ms |
81256 KB |
Output is correct |
38 |
Correct |
146 ms |
81764 KB |
Output is correct |
39 |
Correct |
3 ms |
4936 KB |
Output is correct |
40 |
Correct |
3 ms |
4936 KB |
Output is correct |
41 |
Correct |
3 ms |
5000 KB |
Output is correct |
42 |
Correct |
282 ms |
39748 KB |
Output is correct |
43 |
Correct |
1167 ms |
80900 KB |
Output is correct |
44 |
Correct |
758 ms |
17464 KB |
Output is correct |
45 |
Correct |
1170 ms |
80860 KB |
Output is correct |
46 |
Correct |
402 ms |
31212 KB |
Output is correct |
47 |
Correct |
1088 ms |
80972 KB |
Output is correct |
48 |
Correct |
1046 ms |
81632 KB |
Output is correct |
49 |
Correct |
1040 ms |
82068 KB |
Output is correct |
50 |
Correct |
999 ms |
81636 KB |
Output is correct |
51 |
Correct |
775 ms |
80944 KB |
Output is correct |
52 |
Correct |
998 ms |
81252 KB |
Output is correct |
53 |
Correct |
945 ms |
81712 KB |
Output is correct |
54 |
Correct |
1071 ms |
81708 KB |
Output is correct |
55 |
Correct |
3 ms |
4936 KB |
Output is correct |
56 |
Execution timed out |
4081 ms |
100452 KB |
Time limit exceeded |
57 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
3 ms |
4988 KB |
Output is correct |
2 |
Correct |
3 ms |
4936 KB |
Output is correct |
3 |
Correct |
193 ms |
66024 KB |
Output is correct |
4 |
Correct |
1073 ms |
81764 KB |
Output is correct |
5 |
Correct |
802 ms |
43624 KB |
Output is correct |
6 |
Correct |
1062 ms |
81712 KB |
Output is correct |
7 |
Correct |
745 ms |
57732 KB |
Output is correct |
8 |
Correct |
1078 ms |
81640 KB |
Output is correct |
9 |
Correct |
2 ms |
4936 KB |
Output is correct |
10 |
Correct |
3 ms |
4936 KB |
Output is correct |
11 |
Correct |
3 ms |
4936 KB |
Output is correct |
12 |
Correct |
3 ms |
4936 KB |
Output is correct |
13 |
Correct |
4 ms |
5040 KB |
Output is correct |
14 |
Correct |
10 ms |
5064 KB |
Output is correct |
15 |
Correct |
7 ms |
5104 KB |
Output is correct |
16 |
Correct |
12 ms |
5116 KB |
Output is correct |
17 |
Correct |
6 ms |
5064 KB |
Output is correct |
18 |
Correct |
9 ms |
5064 KB |
Output is correct |
19 |
Correct |
5 ms |
5064 KB |
Output is correct |
20 |
Correct |
9 ms |
5120 KB |
Output is correct |
21 |
Correct |
9 ms |
5064 KB |
Output is correct |
22 |
Correct |
9 ms |
5064 KB |
Output is correct |
23 |
Correct |
14 ms |
5116 KB |
Output is correct |
24 |
Correct |
11 ms |
5064 KB |
Output is correct |
25 |
Correct |
10 ms |
5064 KB |
Output is correct |
26 |
Correct |
3 ms |
4936 KB |
Output is correct |
27 |
Correct |
3 ms |
4936 KB |
Output is correct |
28 |
Correct |
9 ms |
5064 KB |
Output is correct |
29 |
Correct |
8 ms |
5116 KB |
Output is correct |
30 |
Correct |
9 ms |
5132 KB |
Output is correct |
31 |
Correct |
15 ms |
5064 KB |
Output is correct |
32 |
Correct |
10 ms |
5064 KB |
Output is correct |
33 |
Correct |
3 ms |
4936 KB |
Output is correct |
34 |
Correct |
3 ms |
4936 KB |
Output is correct |
35 |
Correct |
4 ms |
4936 KB |
Output is correct |
36 |
Correct |
5 ms |
5064 KB |
Output is correct |
37 |
Correct |
5 ms |
5064 KB |
Output is correct |
38 |
Correct |
4 ms |
5064 KB |
Output is correct |
39 |
Correct |
4 ms |
5064 KB |
Output is correct |
40 |
Correct |
4 ms |
5032 KB |
Output is correct |
41 |
Correct |
3 ms |
4936 KB |
Output is correct |
42 |
Correct |
3 ms |
5064 KB |
Output is correct |
43 |
Correct |
3 ms |
5112 KB |
Output is correct |
44 |
Correct |
3 ms |
5112 KB |
Output is correct |
45 |
Correct |
3 ms |
5064 KB |
Output is correct |
46 |
Correct |
3 ms |
5064 KB |
Output is correct |
47 |
Correct |
3 ms |
5064 KB |
Output is correct |
48 |
Correct |
3 ms |
4936 KB |
Output is correct |
49 |
Correct |
3 ms |
4936 KB |
Output is correct |
50 |
Correct |
3 ms |
4936 KB |
Output is correct |
51 |
Correct |
3 ms |
4936 KB |
Output is correct |
52 |
Correct |
6 ms |
4936 KB |
Output is correct |
53 |
Correct |
9 ms |
5004 KB |
Output is correct |
54 |
Correct |
7 ms |
5064 KB |
Output is correct |
55 |
Correct |
12 ms |
5036 KB |
Output is correct |
56 |
Correct |
5 ms |
5112 KB |
Output is correct |
57 |
Correct |
9 ms |
5116 KB |
Output is correct |
58 |
Correct |
5 ms |
5064 KB |
Output is correct |
59 |
Correct |
10 ms |
5064 KB |
Output is correct |
60 |
Correct |
10 ms |
5064 KB |
Output is correct |
61 |
Correct |
8 ms |
5064 KB |
Output is correct |
62 |
Correct |
15 ms |
5064 KB |
Output is correct |
63 |
Correct |
12 ms |
5064 KB |
Output is correct |
64 |
Correct |
10 ms |
5064 KB |
Output is correct |
65 |
Correct |
3 ms |
5080 KB |
Output is correct |
66 |
Correct |
285 ms |
5832 KB |
Output is correct |
67 |
Correct |
466 ms |
5960 KB |
Output is correct |
68 |
Correct |
50 ms |
5320 KB |
Output is correct |
69 |
Correct |
502 ms |
5980 KB |
Output is correct |
70 |
Correct |
62 ms |
5108 KB |
Output is correct |
71 |
Correct |
444 ms |
5988 KB |
Output is correct |
72 |
Correct |
23 ms |
5704 KB |
Output is correct |
73 |
Correct |
731 ms |
6020 KB |
Output is correct |
74 |
Correct |
795 ms |
6008 KB |
Output is correct |
75 |
Correct |
480 ms |
5984 KB |
Output is correct |
76 |
Correct |
1292 ms |
6008 KB |
Output is correct |
77 |
Correct |
944 ms |
6012 KB |
Output is correct |
78 |
Correct |
1189 ms |
5960 KB |
Output is correct |
79 |
Correct |
4 ms |
4936 KB |
Output is correct |
80 |
Correct |
5 ms |
5044 KB |
Output is correct |
81 |
Correct |
10 ms |
5064 KB |
Output is correct |
82 |
Correct |
10 ms |
5064 KB |
Output is correct |
83 |
Correct |
12 ms |
5124 KB |
Output is correct |
84 |
Correct |
21 ms |
5112 KB |
Output is correct |
85 |
Correct |
11 ms |
5064 KB |
Output is correct |
86 |
Correct |
3 ms |
4996 KB |
Output is correct |
87 |
Correct |
3 ms |
4936 KB |
Output is correct |
88 |
Correct |
5 ms |
4936 KB |
Output is correct |
89 |
Correct |
5 ms |
5064 KB |
Output is correct |
90 |
Correct |
4 ms |
5064 KB |
Output is correct |
91 |
Correct |
5 ms |
5064 KB |
Output is correct |
92 |
Correct |
5 ms |
5064 KB |
Output is correct |
93 |
Correct |
5 ms |
5064 KB |
Output is correct |
94 |
Correct |
4 ms |
4932 KB |
Output is correct |
95 |
Correct |
4 ms |
5064 KB |
Output is correct |
96 |
Correct |
4 ms |
5064 KB |
Output is correct |
97 |
Correct |
3 ms |
5064 KB |
Output is correct |
98 |
Correct |
3 ms |
5060 KB |
Output is correct |
99 |
Correct |
4 ms |
5024 KB |
Output is correct |
100 |
Correct |
3 ms |
5064 KB |
Output is correct |
101 |
Correct |
4 ms |
5076 KB |
Output is correct |
102 |
Correct |
15 ms |
5152 KB |
Output is correct |
103 |
Correct |
488 ms |
5980 KB |
Output is correct |
104 |
Correct |
601 ms |
6028 KB |
Output is correct |
105 |
Correct |
540 ms |
6080 KB |
Output is correct |
106 |
Correct |
1208 ms |
6148 KB |
Output is correct |
107 |
Correct |
505 ms |
6016 KB |
Output is correct |
108 |
Correct |
3 ms |
5064 KB |
Output is correct |
109 |
Correct |
4 ms |
5192 KB |
Output is correct |
110 |
Correct |
26 ms |
5764 KB |
Output is correct |
111 |
Correct |
24 ms |
5704 KB |
Output is correct |
112 |
Correct |
24 ms |
5704 KB |
Output is correct |
113 |
Correct |
26 ms |
5756 KB |
Output is correct |
114 |
Correct |
12 ms |
5704 KB |
Output is correct |
115 |
Correct |
3 ms |
5084 KB |
Output is correct |
116 |
Correct |
4 ms |
5356 KB |
Output is correct |
117 |
Correct |
6 ms |
5832 KB |
Output is correct |
118 |
Correct |
6 ms |
5960 KB |
Output is correct |
119 |
Correct |
6 ms |
5832 KB |
Output is correct |
120 |
Correct |
7 ms |
5960 KB |
Output is correct |
121 |
Correct |
8 ms |
5960 KB |
Output is correct |
122 |
Correct |
3 ms |
4936 KB |
Output is correct |
123 |
Correct |
3 ms |
4936 KB |
Output is correct |
124 |
Correct |
3 ms |
4936 KB |
Output is correct |
125 |
Correct |
3 ms |
4936 KB |
Output is correct |
126 |
Correct |
237 ms |
74356 KB |
Output is correct |
127 |
Correct |
334 ms |
87824 KB |
Output is correct |
128 |
Correct |
106 ms |
43904 KB |
Output is correct |
129 |
Correct |
385 ms |
101008 KB |
Output is correct |
130 |
Correct |
45 ms |
18244 KB |
Output is correct |
131 |
Correct |
260 ms |
86344 KB |
Output is correct |
132 |
Correct |
142 ms |
81712 KB |
Output is correct |
133 |
Correct |
674 ms |
101288 KB |
Output is correct |
134 |
Correct |
367 ms |
96876 KB |
Output is correct |
135 |
Correct |
266 ms |
85576 KB |
Output is correct |
136 |
Correct |
635 ms |
102424 KB |
Output is correct |
137 |
Correct |
481 ms |
102900 KB |
Output is correct |
138 |
Correct |
645 ms |
102860 KB |
Output is correct |
139 |
Correct |
3 ms |
4936 KB |
Output is correct |
140 |
Correct |
3 ms |
5064 KB |
Output is correct |
141 |
Correct |
3 ms |
5064 KB |
Output is correct |
142 |
Correct |
3 ms |
5064 KB |
Output is correct |
143 |
Correct |
3 ms |
5064 KB |
Output is correct |
144 |
Correct |
3 ms |
5064 KB |
Output is correct |
145 |
Correct |
3 ms |
5064 KB |
Output is correct |
146 |
Correct |
3 ms |
5064 KB |
Output is correct |
147 |
Correct |
4 ms |
5344 KB |
Output is correct |
148 |
Correct |
8 ms |
5832 KB |
Output is correct |
149 |
Correct |
6 ms |
5960 KB |
Output is correct |
150 |
Correct |
5 ms |
5832 KB |
Output is correct |
151 |
Correct |
7 ms |
5960 KB |
Output is correct |
152 |
Correct |
8 ms |
5960 KB |
Output is correct |
153 |
Correct |
3 ms |
4936 KB |
Output is correct |
154 |
Correct |
221 ms |
80768 KB |
Output is correct |
155 |
Correct |
283 ms |
88524 KB |
Output is correct |
156 |
Correct |
355 ms |
96412 KB |
Output is correct |
157 |
Correct |
247 ms |
83616 KB |
Output is correct |
158 |
Correct |
373 ms |
99692 KB |
Output is correct |
159 |
Correct |
313 ms |
102852 KB |
Output is correct |
160 |
Correct |
3 ms |
4936 KB |
Output is correct |
161 |
Correct |
129 ms |
48916 KB |
Output is correct |
162 |
Correct |
235 ms |
80888 KB |
Output is correct |
163 |
Correct |
142 ms |
81604 KB |
Output is correct |
164 |
Correct |
221 ms |
80900 KB |
Output is correct |
165 |
Correct |
199 ms |
81376 KB |
Output is correct |
166 |
Correct |
143 ms |
81636 KB |
Output is correct |
167 |
Correct |
3 ms |
4936 KB |
Output is correct |
168 |
Correct |
3 ms |
4936 KB |
Output is correct |
169 |
Correct |
3 ms |
4936 KB |
Output is correct |
170 |
Correct |
250 ms |
39740 KB |
Output is correct |
171 |
Correct |
1213 ms |
81000 KB |
Output is correct |
172 |
Correct |
673 ms |
17472 KB |
Output is correct |
173 |
Correct |
1066 ms |
80944 KB |
Output is correct |
174 |
Correct |
624 ms |
31172 KB |
Output is correct |
175 |
Correct |
1036 ms |
80944 KB |
Output is correct |
176 |
Correct |
984 ms |
81712 KB |
Output is correct |
177 |
Correct |
1234 ms |
82080 KB |
Output is correct |
178 |
Correct |
1018 ms |
81500 KB |
Output is correct |
179 |
Correct |
1085 ms |
80860 KB |
Output is correct |
180 |
Correct |
820 ms |
81200 KB |
Output is correct |
181 |
Correct |
1077 ms |
81712 KB |
Output is correct |
182 |
Correct |
1022 ms |
81640 KB |
Output is correct |
183 |
Correct |
3 ms |
4936 KB |
Output is correct |
184 |
Correct |
3 ms |
4936 KB |
Output is correct |
185 |
Correct |
4 ms |
4936 KB |
Output is correct |
186 |
Correct |
5 ms |
5064 KB |
Output is correct |
187 |
Correct |
5 ms |
5064 KB |
Output is correct |
188 |
Correct |
5 ms |
5064 KB |
Output is correct |
189 |
Correct |
5 ms |
5064 KB |
Output is correct |
190 |
Correct |
5 ms |
5008 KB |
Output is correct |
191 |
Correct |
3 ms |
5064 KB |
Output is correct |
192 |
Correct |
4 ms |
5316 KB |
Output is correct |
193 |
Correct |
15 ms |
5704 KB |
Output is correct |
194 |
Correct |
25 ms |
5704 KB |
Output is correct |
195 |
Correct |
23 ms |
5704 KB |
Output is correct |
196 |
Correct |
25 ms |
5704 KB |
Output is correct |
197 |
Correct |
18 ms |
5704 KB |
Output is correct |
198 |
Correct |
3 ms |
4936 KB |
Output is correct |
199 |
Correct |
122 ms |
48948 KB |
Output is correct |
200 |
Correct |
221 ms |
80888 KB |
Output is correct |
201 |
Correct |
141 ms |
81664 KB |
Output is correct |
202 |
Correct |
197 ms |
80864 KB |
Output is correct |
203 |
Correct |
199 ms |
81256 KB |
Output is correct |
204 |
Correct |
146 ms |
81764 KB |
Output is correct |
205 |
Correct |
3 ms |
4936 KB |
Output is correct |
206 |
Correct |
3 ms |
4936 KB |
Output is correct |
207 |
Correct |
3 ms |
5000 KB |
Output is correct |
208 |
Correct |
282 ms |
39748 KB |
Output is correct |
209 |
Correct |
1167 ms |
80900 KB |
Output is correct |
210 |
Correct |
758 ms |
17464 KB |
Output is correct |
211 |
Correct |
1170 ms |
80860 KB |
Output is correct |
212 |
Correct |
402 ms |
31212 KB |
Output is correct |
213 |
Correct |
1088 ms |
80972 KB |
Output is correct |
214 |
Correct |
1046 ms |
81632 KB |
Output is correct |
215 |
Correct |
1040 ms |
82068 KB |
Output is correct |
216 |
Correct |
999 ms |
81636 KB |
Output is correct |
217 |
Correct |
775 ms |
80944 KB |
Output is correct |
218 |
Correct |
998 ms |
81252 KB |
Output is correct |
219 |
Correct |
945 ms |
81712 KB |
Output is correct |
220 |
Correct |
1071 ms |
81708 KB |
Output is correct |
221 |
Correct |
3 ms |
4936 KB |
Output is correct |
222 |
Execution timed out |
4081 ms |
100452 KB |
Time limit exceeded |
223 |
Halted |
0 ms |
0 KB |
- |