#include "towers.h"
#include <iostream>
#include <vector>
#include <set>
#include <algorithm>
#include <utility>
#include <tuple>
#define pii pair<int, int>
#define piii pair<int, pii>
#define pll pair<long long, long long>
#define plll pair<long long, pll>
#define tiii tuple<int, int, int>
#define tiiii tuple<int, int, int, int>
#define ff first
#define ss second
#define ee ss.ff
#define rr ss.ss
#define DEBUG
const int INF = (int)1e9 + 7;
using namespace std;
int N, M;
vector<int> H;
vector<int> P;
vector<int> ind;
vector<pii> indm;
vector<pii> LD, RD;
vector<int> GD;
vector<int> DS;
vector<int> DH;
vector<int> Lroot, Rroot, LDroot, RDroot;
int qry(int l, int r)
{
int ret = 0;
for(int x = l + N, y = r + N; x != y; x >>= 1, y >>= 1)
{
if(x & 1) ret = max(ret, ind[x++]);
if(y & 1) ret = max(ret, ind[--y]);
}
return ret;
}
int qrym(int l, int r)
{
pii ret = {INF, INF};
for(int x = l + N, y = r + N; x != y; x >>= 1, y >>= 1)
{
if(x & 1) ret = min(ret, indm[x++]);
if(y & 1) ret = min(ret, indm[--y]);
}
return ret.ss;
}
struct SEG
{
struct Node
{
int x;
int l, r;
Node(void) : x(0), l(-1), r(-1) {}
}nd[40404040];
int cnt = 0;
int init(int s, int e, const vector<int> &V)
{
int ret = cnt++;
if(s + 1 == e)
{
nd[ret].x = V[s];
return ret;
}
int mid = s + e >> 1;
nd[ret].l = init(s, mid, V);
nd[ret].r = init(mid, e, V);
nd[ret].x = nd[nd[ret].l].x + nd[nd[ret].r].x;
return ret;
}
int upd(int ind, int s, int e, int x, int v)
{
int ret = cnt++;
nd[ret] = nd[ind];
if(s + 1 == e)
{
nd[ret].x += v;
return ret;
}
int mid = s + e >> 1;
if(x < mid) nd[ret].l = upd(nd[ret].l, s, mid, x, v);
else nd[ret].r = upd(nd[ret].r, mid, e, x, v);
nd[ret].x = nd[nd[ret].l].x + nd[nd[ret].r].x;
return ret;
}
int qry(int ind, int s, int e, int l, int r)
{
if(e <= l || r <= s) return 0;
if(l <= s && e <= r) return nd[ind].x;
int mid = s + e >> 1;
return qry(nd[ind].l, s, mid, l, r) + qry(nd[ind].r, mid, e, l, r);
}
}seg;
void init(int _N, vector<int> _H)
{
N = _N;
H = _H;
for(int i = 0; i < N; ++i) P.push_back(i);
sort(P.begin(), P.end(), [](int x, int y){return H[x] < H[y];});
ind.resize(2 * N);
for(int i = 0; i < N; ++i) ind[i + N] = H[i];
for(int i = N - 1; i >= 1; --i) ind[i] = max(ind[i << 1], ind[i << 1 | 1]);
indm.resize(2 * N);
for(int i = 0; i < N; ++i) indm[i + N] = { H[i], i };
for(int i = N - 1; i >= 1; --i) indm[i] = min(indm[i << 1], indm[i << 1 | 1]);
set<int> S;
LD.resize(N);
RD.resize(N);
GD.resize(N);
for(int i : P)
{
auto it = S.lower_bound(i);
int l = (it == S.begin() ? -1 : *prev(it));
int r = (it == S.end() ? N : *it);
LD[i] = { l, qry(l + 1, i + 1) - H[i] };
RD[i] = { r, qry(i, r) - H[i] };
GD[i] = min(LD[i].ss, RD[i].ss);
DH.push_back(LD[i].ss);
DH.push_back(RD[i].ss);
S.insert(i);
}
sort(DH.begin(), DH.end());
DH.resize(unique(DH.begin(), DH.end()) - DH.begin());
M = DH.size();
for(int i = 0; i < N; ++i)
{
LD[i].ss = lower_bound(DH.begin(), DH.end(), LD[i].ss) - DH.begin();
RD[i].ss = lower_bound(DH.begin(), DH.end(), RD[i].ss) - DH.begin();
GD[i] = lower_bound(DH.begin(), DH.end(), GD[i]) - DH.begin();
DS.push_back(GD[i]);
}
sort(DS.begin(), DS.end());
Lroot.resize(N + 1);
Rroot.resize(N + 1);
vector<int> tmp(M);
vector<int> ls[N + 1];
for(int i = 0; i < N; ++i) ++tmp[GD[i]], ls[LD[i].ff + 1].push_back(i);
Lroot[0] = Rroot[N] = seg.init(0, M, tmp);
for(int i = 0; i <= N; ++i)
{
if(i) Lroot[i] = Lroot[i - 1];
for(auto x : ls[i])
{
Lroot[i] = seg.upd(Lroot[i], 0, M, GD[x], -1);
Lroot[i] = seg.upd(Lroot[i], 0, M, RD[x].ss, 1);
}
}
for(auto &v : ls) v.clear();
for(int i = 0; i < N; ++i) ls[RD[i].ff].push_back(i);
for(int i = N - 1; i >= 0; --i)
{
Rroot[i] = Rroot[i + 1];
for(auto x : ls[i + 1])
{
Rroot[i] = seg.upd(Rroot[i], 0, M, GD[x], -1);
Rroot[i] = seg.upd(Rroot[i], 0, M, LD[x].ss, 1);
}
}
LDroot.resize(N);
LDroot[0] = seg.init(0, M, vector<int>(M));
for(int i = 1; i < N; ++i) LDroot[i] = seg.upd(LDroot[i - 1], 0, M, RD[i - 1].ss, 1);
RDroot.resize(N);
RDroot[N - 1] = LDroot[0];
for(int i = N - 2; i >= 0; --i) RDroot[i] = seg.upd(RDroot[i + 1], 0, M, LD[i + 1].ss, 1);
// for(int i = 0; i < N; ++i)
// {
// cout << LD[i].ff << ' ' << LD[i].ss << ' ' << RD[i].ff << ' ' << RD[i].ss << endl;
// }
}
int max_towers(int L, int R, int D)
{
D = lower_bound(DH.begin(), DH.end(), D) - DH.begin();
int m = qrym(L, R + 1);
// cout << seg.qry(Lroot[L], 0, M, D, M) << endl;
// cout << seg.qry(Rroot[R], 0, M, D, M) << endl;
// cout << (DS.end() - lower_bound(DS.begin(), DS.end(), D)) << endl;
// cout << (GD[m] >= D ? 1 : 0) << endl;
// cout << (LD[m].ss >= D ? 1 : 0) << endl;
// cout << (RD[m].ss >= D ? 1 : 0) << endl;
// cout << seg.qry(LDroot[L], 0, M, D, M) << endl;
// cout << seg.qry(RDroot[R], 0, M, D, M) << endl;
return seg.qry(Lroot[L], 0, M, D, M) + seg.qry(Rroot[R], 0, M, D, M)
- (DS.end() - lower_bound(DS.begin(), DS.end(), D))
+ (GD[m] >= D ? 1 : 0) - (LD[m].ss >= D ? 1 : 0) - (RD[m].ss >= D ? 1 : 0)
- seg.qry(LDroot[L], 0, M, D, M) - seg.qry(RDroot[R], 0, M, D, M) + 1;
}
Compilation message
towers.cpp: In member function 'int SEG::init(int, int, const std::vector<int>&)':
towers.cpp:76:21: warning: suggest parentheses around '+' inside '>>' [-Wparentheses]
76 | int mid = s + e >> 1;
| ~~^~~
towers.cpp: In member function 'int SEG::upd(int, int, int, int, int)':
towers.cpp:94:21: warning: suggest parentheses around '+' inside '>>' [-Wparentheses]
94 | int mid = s + e >> 1;
| ~~^~~
towers.cpp: In member function 'int SEG::qry(int, int, int, int, int)':
towers.cpp:106:21: warning: suggest parentheses around '+' inside '>>' [-Wparentheses]
106 | int mid = s + e >> 1;
| ~~^~~
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
843 ms |
486312 KB |
Output is correct |
2 |
Correct |
1280 ms |
494364 KB |
Output is correct |
3 |
Correct |
1411 ms |
494500 KB |
Output is correct |
4 |
Correct |
1317 ms |
494368 KB |
Output is correct |
5 |
Correct |
1417 ms |
494340 KB |
Output is correct |
6 |
Correct |
1240 ms |
494472 KB |
Output is correct |
7 |
Correct |
1330 ms |
494284 KB |
Output is correct |
8 |
Correct |
204 ms |
474564 KB |
Output is correct |
9 |
Correct |
207 ms |
475000 KB |
Output is correct |
10 |
Correct |
199 ms |
475020 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
204 ms |
474760 KB |
Output is correct |
2 |
Correct |
209 ms |
474952 KB |
Output is correct |
3 |
Correct |
204 ms |
474952 KB |
Output is correct |
4 |
Correct |
207 ms |
475036 KB |
Output is correct |
5 |
Correct |
213 ms |
475184 KB |
Output is correct |
6 |
Correct |
207 ms |
475064 KB |
Output is correct |
7 |
Correct |
209 ms |
475048 KB |
Output is correct |
8 |
Correct |
202 ms |
475080 KB |
Output is correct |
9 |
Correct |
205 ms |
475064 KB |
Output is correct |
10 |
Correct |
207 ms |
475112 KB |
Output is correct |
11 |
Correct |
202 ms |
475076 KB |
Output is correct |
12 |
Correct |
232 ms |
474664 KB |
Output is correct |
13 |
Correct |
205 ms |
474952 KB |
Output is correct |
14 |
Correct |
205 ms |
475020 KB |
Output is correct |
15 |
Correct |
203 ms |
475024 KB |
Output is correct |
16 |
Correct |
208 ms |
474952 KB |
Output is correct |
17 |
Correct |
208 ms |
475060 KB |
Output is correct |
18 |
Correct |
203 ms |
475080 KB |
Output is correct |
19 |
Correct |
203 ms |
475172 KB |
Output is correct |
20 |
Correct |
208 ms |
475004 KB |
Output is correct |
21 |
Correct |
217 ms |
474952 KB |
Output is correct |
22 |
Correct |
206 ms |
474968 KB |
Output is correct |
23 |
Correct |
206 ms |
475000 KB |
Output is correct |
24 |
Correct |
210 ms |
474968 KB |
Output is correct |
25 |
Correct |
204 ms |
474932 KB |
Output is correct |
26 |
Correct |
208 ms |
475112 KB |
Output is correct |
27 |
Correct |
206 ms |
475060 KB |
Output is correct |
28 |
Correct |
206 ms |
475016 KB |
Output is correct |
29 |
Correct |
207 ms |
475012 KB |
Output is correct |
30 |
Correct |
219 ms |
475036 KB |
Output is correct |
31 |
Correct |
215 ms |
474976 KB |
Output is correct |
32 |
Correct |
213 ms |
475060 KB |
Output is correct |
33 |
Correct |
211 ms |
475076 KB |
Output is correct |
34 |
Correct |
209 ms |
474996 KB |
Output is correct |
35 |
Correct |
210 ms |
474972 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
204 ms |
474760 KB |
Output is correct |
2 |
Correct |
209 ms |
474952 KB |
Output is correct |
3 |
Correct |
204 ms |
474952 KB |
Output is correct |
4 |
Correct |
207 ms |
475036 KB |
Output is correct |
5 |
Correct |
213 ms |
475184 KB |
Output is correct |
6 |
Correct |
207 ms |
475064 KB |
Output is correct |
7 |
Correct |
209 ms |
475048 KB |
Output is correct |
8 |
Correct |
202 ms |
475080 KB |
Output is correct |
9 |
Correct |
205 ms |
475064 KB |
Output is correct |
10 |
Correct |
207 ms |
475112 KB |
Output is correct |
11 |
Correct |
202 ms |
475076 KB |
Output is correct |
12 |
Correct |
232 ms |
474664 KB |
Output is correct |
13 |
Correct |
205 ms |
474952 KB |
Output is correct |
14 |
Correct |
205 ms |
475020 KB |
Output is correct |
15 |
Correct |
203 ms |
475024 KB |
Output is correct |
16 |
Correct |
208 ms |
474952 KB |
Output is correct |
17 |
Correct |
208 ms |
475060 KB |
Output is correct |
18 |
Correct |
203 ms |
475080 KB |
Output is correct |
19 |
Correct |
203 ms |
475172 KB |
Output is correct |
20 |
Correct |
208 ms |
475004 KB |
Output is correct |
21 |
Correct |
217 ms |
474952 KB |
Output is correct |
22 |
Correct |
206 ms |
474968 KB |
Output is correct |
23 |
Correct |
206 ms |
475000 KB |
Output is correct |
24 |
Correct |
210 ms |
474968 KB |
Output is correct |
25 |
Correct |
204 ms |
474932 KB |
Output is correct |
26 |
Correct |
208 ms |
475112 KB |
Output is correct |
27 |
Correct |
206 ms |
475060 KB |
Output is correct |
28 |
Correct |
206 ms |
475016 KB |
Output is correct |
29 |
Correct |
207 ms |
475012 KB |
Output is correct |
30 |
Correct |
219 ms |
475036 KB |
Output is correct |
31 |
Correct |
215 ms |
474976 KB |
Output is correct |
32 |
Correct |
213 ms |
475060 KB |
Output is correct |
33 |
Correct |
211 ms |
475076 KB |
Output is correct |
34 |
Correct |
209 ms |
474996 KB |
Output is correct |
35 |
Correct |
210 ms |
474972 KB |
Output is correct |
36 |
Correct |
359 ms |
487388 KB |
Output is correct |
37 |
Correct |
452 ms |
494004 KB |
Output is correct |
38 |
Correct |
453 ms |
493940 KB |
Output is correct |
39 |
Correct |
446 ms |
494108 KB |
Output is correct |
40 |
Correct |
437 ms |
494120 KB |
Output is correct |
41 |
Correct |
434 ms |
494000 KB |
Output is correct |
42 |
Correct |
441 ms |
493976 KB |
Output is correct |
43 |
Correct |
358 ms |
494396 KB |
Output is correct |
44 |
Correct |
361 ms |
494396 KB |
Output is correct |
45 |
Correct |
367 ms |
494668 KB |
Output is correct |
46 |
Correct |
360 ms |
494344 KB |
Output is correct |
47 |
Correct |
463 ms |
493892 KB |
Output is correct |
48 |
Correct |
457 ms |
493992 KB |
Output is correct |
49 |
Correct |
459 ms |
493972 KB |
Output is correct |
50 |
Correct |
362 ms |
494280 KB |
Output is correct |
51 |
Correct |
356 ms |
494344 KB |
Output is correct |
52 |
Correct |
438 ms |
494012 KB |
Output is correct |
53 |
Correct |
433 ms |
494048 KB |
Output is correct |
54 |
Correct |
431 ms |
493912 KB |
Output is correct |
55 |
Correct |
361 ms |
494296 KB |
Output is correct |
56 |
Correct |
365 ms |
494604 KB |
Output is correct |
57 |
Correct |
438 ms |
493364 KB |
Output is correct |
58 |
Correct |
441 ms |
493932 KB |
Output is correct |
59 |
Correct |
435 ms |
494020 KB |
Output is correct |
60 |
Correct |
437 ms |
494012 KB |
Output is correct |
61 |
Correct |
453 ms |
494024 KB |
Output is correct |
62 |
Correct |
443 ms |
493876 KB |
Output is correct |
63 |
Correct |
442 ms |
493900 KB |
Output is correct |
64 |
Correct |
359 ms |
494436 KB |
Output is correct |
65 |
Correct |
372 ms |
494292 KB |
Output is correct |
66 |
Correct |
371 ms |
494708 KB |
Output is correct |
67 |
Correct |
371 ms |
494188 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1370 ms |
493832 KB |
Output is correct |
2 |
Correct |
1386 ms |
494020 KB |
Output is correct |
3 |
Correct |
1433 ms |
494008 KB |
Output is correct |
4 |
Correct |
1447 ms |
494128 KB |
Output is correct |
5 |
Correct |
1414 ms |
493908 KB |
Output is correct |
6 |
Correct |
1441 ms |
494012 KB |
Output is correct |
7 |
Correct |
1537 ms |
493948 KB |
Output is correct |
8 |
Correct |
1317 ms |
494424 KB |
Output is correct |
9 |
Correct |
1277 ms |
494268 KB |
Output is correct |
10 |
Correct |
1319 ms |
494768 KB |
Output is correct |
11 |
Correct |
1074 ms |
494220 KB |
Output is correct |
12 |
Correct |
1299 ms |
494408 KB |
Output is correct |
13 |
Correct |
1177 ms |
494236 KB |
Output is correct |
14 |
Correct |
208 ms |
474568 KB |
Output is correct |
15 |
Correct |
217 ms |
475008 KB |
Output is correct |
16 |
Correct |
211 ms |
475040 KB |
Output is correct |
17 |
Correct |
445 ms |
494108 KB |
Output is correct |
18 |
Correct |
448 ms |
493932 KB |
Output is correct |
19 |
Correct |
473 ms |
494156 KB |
Output is correct |
20 |
Correct |
364 ms |
494276 KB |
Output is correct |
21 |
Correct |
365 ms |
494440 KB |
Output is correct |
22 |
Correct |
462 ms |
493904 KB |
Output is correct |
23 |
Correct |
443 ms |
494012 KB |
Output is correct |
24 |
Correct |
449 ms |
494040 KB |
Output is correct |
25 |
Correct |
376 ms |
494328 KB |
Output is correct |
26 |
Correct |
366 ms |
494640 KB |
Output is correct |
27 |
Correct |
212 ms |
475024 KB |
Output is correct |
28 |
Correct |
212 ms |
474960 KB |
Output is correct |
29 |
Correct |
209 ms |
475056 KB |
Output is correct |
30 |
Correct |
231 ms |
475124 KB |
Output is correct |
31 |
Correct |
219 ms |
474996 KB |
Output is correct |
32 |
Correct |
210 ms |
474968 KB |
Output is correct |
33 |
Correct |
211 ms |
475020 KB |
Output is correct |
34 |
Correct |
211 ms |
474964 KB |
Output is correct |
35 |
Correct |
209 ms |
474980 KB |
Output is correct |
36 |
Correct |
238 ms |
475036 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
559 ms |
479316 KB |
Output is correct |
2 |
Correct |
1319 ms |
493896 KB |
Output is correct |
3 |
Correct |
1417 ms |
493884 KB |
Output is correct |
4 |
Correct |
1203 ms |
494012 KB |
Output is correct |
5 |
Correct |
1367 ms |
493916 KB |
Output is correct |
6 |
Correct |
1433 ms |
494096 KB |
Output is correct |
7 |
Correct |
1284 ms |
493892 KB |
Output is correct |
8 |
Correct |
1283 ms |
494312 KB |
Output is correct |
9 |
Correct |
1181 ms |
494264 KB |
Output is correct |
10 |
Correct |
1291 ms |
494648 KB |
Output is correct |
11 |
Correct |
1063 ms |
494272 KB |
Output is correct |
12 |
Correct |
451 ms |
494064 KB |
Output is correct |
13 |
Correct |
448 ms |
494012 KB |
Output is correct |
14 |
Correct |
437 ms |
493964 KB |
Output is correct |
15 |
Correct |
362 ms |
494412 KB |
Output is correct |
16 |
Correct |
370 ms |
494592 KB |
Output is correct |
17 |
Correct |
440 ms |
493428 KB |
Output is correct |
18 |
Correct |
448 ms |
494016 KB |
Output is correct |
19 |
Correct |
447 ms |
494012 KB |
Output is correct |
20 |
Correct |
456 ms |
493884 KB |
Output is correct |
21 |
Correct |
468 ms |
493956 KB |
Output is correct |
22 |
Correct |
458 ms |
494012 KB |
Output is correct |
23 |
Correct |
446 ms |
493920 KB |
Output is correct |
24 |
Correct |
358 ms |
494476 KB |
Output is correct |
25 |
Correct |
362 ms |
494288 KB |
Output is correct |
26 |
Correct |
375 ms |
494600 KB |
Output is correct |
27 |
Correct |
369 ms |
494296 KB |
Output is correct |
28 |
Correct |
210 ms |
475132 KB |
Output is correct |
29 |
Correct |
207 ms |
475076 KB |
Output is correct |
30 |
Correct |
213 ms |
474956 KB |
Output is correct |
31 |
Correct |
211 ms |
475020 KB |
Output is correct |
32 |
Correct |
209 ms |
475080 KB |
Output is correct |
33 |
Correct |
209 ms |
474752 KB |
Output is correct |
34 |
Correct |
213 ms |
474960 KB |
Output is correct |
35 |
Correct |
209 ms |
475028 KB |
Output is correct |
36 |
Correct |
218 ms |
475052 KB |
Output is correct |
37 |
Correct |
218 ms |
474992 KB |
Output is correct |
38 |
Correct |
214 ms |
475068 KB |
Output is correct |
39 |
Correct |
213 ms |
475036 KB |
Output is correct |
40 |
Correct |
207 ms |
475080 KB |
Output is correct |
41 |
Correct |
212 ms |
475080 KB |
Output is correct |
42 |
Correct |
223 ms |
475092 KB |
Output is correct |
43 |
Correct |
206 ms |
475012 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
204 ms |
474760 KB |
Output is correct |
2 |
Correct |
209 ms |
474952 KB |
Output is correct |
3 |
Correct |
204 ms |
474952 KB |
Output is correct |
4 |
Correct |
207 ms |
475036 KB |
Output is correct |
5 |
Correct |
213 ms |
475184 KB |
Output is correct |
6 |
Correct |
207 ms |
475064 KB |
Output is correct |
7 |
Correct |
209 ms |
475048 KB |
Output is correct |
8 |
Correct |
202 ms |
475080 KB |
Output is correct |
9 |
Correct |
205 ms |
475064 KB |
Output is correct |
10 |
Correct |
207 ms |
475112 KB |
Output is correct |
11 |
Correct |
202 ms |
475076 KB |
Output is correct |
12 |
Correct |
232 ms |
474664 KB |
Output is correct |
13 |
Correct |
205 ms |
474952 KB |
Output is correct |
14 |
Correct |
205 ms |
475020 KB |
Output is correct |
15 |
Correct |
203 ms |
475024 KB |
Output is correct |
16 |
Correct |
208 ms |
474952 KB |
Output is correct |
17 |
Correct |
208 ms |
475060 KB |
Output is correct |
18 |
Correct |
203 ms |
475080 KB |
Output is correct |
19 |
Correct |
203 ms |
475172 KB |
Output is correct |
20 |
Correct |
208 ms |
475004 KB |
Output is correct |
21 |
Correct |
217 ms |
474952 KB |
Output is correct |
22 |
Correct |
206 ms |
474968 KB |
Output is correct |
23 |
Correct |
206 ms |
475000 KB |
Output is correct |
24 |
Correct |
210 ms |
474968 KB |
Output is correct |
25 |
Correct |
204 ms |
474932 KB |
Output is correct |
26 |
Correct |
208 ms |
475112 KB |
Output is correct |
27 |
Correct |
206 ms |
475060 KB |
Output is correct |
28 |
Correct |
206 ms |
475016 KB |
Output is correct |
29 |
Correct |
207 ms |
475012 KB |
Output is correct |
30 |
Correct |
219 ms |
475036 KB |
Output is correct |
31 |
Correct |
215 ms |
474976 KB |
Output is correct |
32 |
Correct |
213 ms |
475060 KB |
Output is correct |
33 |
Correct |
211 ms |
475076 KB |
Output is correct |
34 |
Correct |
209 ms |
474996 KB |
Output is correct |
35 |
Correct |
210 ms |
474972 KB |
Output is correct |
36 |
Correct |
359 ms |
487388 KB |
Output is correct |
37 |
Correct |
452 ms |
494004 KB |
Output is correct |
38 |
Correct |
453 ms |
493940 KB |
Output is correct |
39 |
Correct |
446 ms |
494108 KB |
Output is correct |
40 |
Correct |
437 ms |
494120 KB |
Output is correct |
41 |
Correct |
434 ms |
494000 KB |
Output is correct |
42 |
Correct |
441 ms |
493976 KB |
Output is correct |
43 |
Correct |
358 ms |
494396 KB |
Output is correct |
44 |
Correct |
361 ms |
494396 KB |
Output is correct |
45 |
Correct |
367 ms |
494668 KB |
Output is correct |
46 |
Correct |
360 ms |
494344 KB |
Output is correct |
47 |
Correct |
463 ms |
493892 KB |
Output is correct |
48 |
Correct |
457 ms |
493992 KB |
Output is correct |
49 |
Correct |
459 ms |
493972 KB |
Output is correct |
50 |
Correct |
362 ms |
494280 KB |
Output is correct |
51 |
Correct |
356 ms |
494344 KB |
Output is correct |
52 |
Correct |
438 ms |
494012 KB |
Output is correct |
53 |
Correct |
433 ms |
494048 KB |
Output is correct |
54 |
Correct |
431 ms |
493912 KB |
Output is correct |
55 |
Correct |
361 ms |
494296 KB |
Output is correct |
56 |
Correct |
365 ms |
494604 KB |
Output is correct |
57 |
Correct |
438 ms |
493364 KB |
Output is correct |
58 |
Correct |
441 ms |
493932 KB |
Output is correct |
59 |
Correct |
435 ms |
494020 KB |
Output is correct |
60 |
Correct |
437 ms |
494012 KB |
Output is correct |
61 |
Correct |
453 ms |
494024 KB |
Output is correct |
62 |
Correct |
443 ms |
493876 KB |
Output is correct |
63 |
Correct |
442 ms |
493900 KB |
Output is correct |
64 |
Correct |
359 ms |
494436 KB |
Output is correct |
65 |
Correct |
372 ms |
494292 KB |
Output is correct |
66 |
Correct |
371 ms |
494708 KB |
Output is correct |
67 |
Correct |
371 ms |
494188 KB |
Output is correct |
68 |
Correct |
1370 ms |
493832 KB |
Output is correct |
69 |
Correct |
1386 ms |
494020 KB |
Output is correct |
70 |
Correct |
1433 ms |
494008 KB |
Output is correct |
71 |
Correct |
1447 ms |
494128 KB |
Output is correct |
72 |
Correct |
1414 ms |
493908 KB |
Output is correct |
73 |
Correct |
1441 ms |
494012 KB |
Output is correct |
74 |
Correct |
1537 ms |
493948 KB |
Output is correct |
75 |
Correct |
1317 ms |
494424 KB |
Output is correct |
76 |
Correct |
1277 ms |
494268 KB |
Output is correct |
77 |
Correct |
1319 ms |
494768 KB |
Output is correct |
78 |
Correct |
1074 ms |
494220 KB |
Output is correct |
79 |
Correct |
1299 ms |
494408 KB |
Output is correct |
80 |
Correct |
1177 ms |
494236 KB |
Output is correct |
81 |
Correct |
208 ms |
474568 KB |
Output is correct |
82 |
Correct |
217 ms |
475008 KB |
Output is correct |
83 |
Correct |
211 ms |
475040 KB |
Output is correct |
84 |
Correct |
445 ms |
494108 KB |
Output is correct |
85 |
Correct |
448 ms |
493932 KB |
Output is correct |
86 |
Correct |
473 ms |
494156 KB |
Output is correct |
87 |
Correct |
364 ms |
494276 KB |
Output is correct |
88 |
Correct |
365 ms |
494440 KB |
Output is correct |
89 |
Correct |
462 ms |
493904 KB |
Output is correct |
90 |
Correct |
443 ms |
494012 KB |
Output is correct |
91 |
Correct |
449 ms |
494040 KB |
Output is correct |
92 |
Correct |
376 ms |
494328 KB |
Output is correct |
93 |
Correct |
366 ms |
494640 KB |
Output is correct |
94 |
Correct |
212 ms |
475024 KB |
Output is correct |
95 |
Correct |
212 ms |
474960 KB |
Output is correct |
96 |
Correct |
209 ms |
475056 KB |
Output is correct |
97 |
Correct |
231 ms |
475124 KB |
Output is correct |
98 |
Correct |
219 ms |
474996 KB |
Output is correct |
99 |
Correct |
210 ms |
474968 KB |
Output is correct |
100 |
Correct |
211 ms |
475020 KB |
Output is correct |
101 |
Correct |
211 ms |
474964 KB |
Output is correct |
102 |
Correct |
209 ms |
474980 KB |
Output is correct |
103 |
Correct |
238 ms |
475036 KB |
Output is correct |
104 |
Correct |
1291 ms |
491856 KB |
Output is correct |
105 |
Correct |
1616 ms |
493916 KB |
Output is correct |
106 |
Incorrect |
1726 ms |
493916 KB |
10307th lines differ - on the 1st token, expected: '1', found: '2' |
107 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
843 ms |
486312 KB |
Output is correct |
2 |
Correct |
1280 ms |
494364 KB |
Output is correct |
3 |
Correct |
1411 ms |
494500 KB |
Output is correct |
4 |
Correct |
1317 ms |
494368 KB |
Output is correct |
5 |
Correct |
1417 ms |
494340 KB |
Output is correct |
6 |
Correct |
1240 ms |
494472 KB |
Output is correct |
7 |
Correct |
1330 ms |
494284 KB |
Output is correct |
8 |
Correct |
204 ms |
474564 KB |
Output is correct |
9 |
Correct |
207 ms |
475000 KB |
Output is correct |
10 |
Correct |
199 ms |
475020 KB |
Output is correct |
11 |
Correct |
204 ms |
474760 KB |
Output is correct |
12 |
Correct |
209 ms |
474952 KB |
Output is correct |
13 |
Correct |
204 ms |
474952 KB |
Output is correct |
14 |
Correct |
207 ms |
475036 KB |
Output is correct |
15 |
Correct |
213 ms |
475184 KB |
Output is correct |
16 |
Correct |
207 ms |
475064 KB |
Output is correct |
17 |
Correct |
209 ms |
475048 KB |
Output is correct |
18 |
Correct |
202 ms |
475080 KB |
Output is correct |
19 |
Correct |
205 ms |
475064 KB |
Output is correct |
20 |
Correct |
207 ms |
475112 KB |
Output is correct |
21 |
Correct |
202 ms |
475076 KB |
Output is correct |
22 |
Correct |
232 ms |
474664 KB |
Output is correct |
23 |
Correct |
205 ms |
474952 KB |
Output is correct |
24 |
Correct |
205 ms |
475020 KB |
Output is correct |
25 |
Correct |
203 ms |
475024 KB |
Output is correct |
26 |
Correct |
208 ms |
474952 KB |
Output is correct |
27 |
Correct |
208 ms |
475060 KB |
Output is correct |
28 |
Correct |
203 ms |
475080 KB |
Output is correct |
29 |
Correct |
203 ms |
475172 KB |
Output is correct |
30 |
Correct |
208 ms |
475004 KB |
Output is correct |
31 |
Correct |
217 ms |
474952 KB |
Output is correct |
32 |
Correct |
206 ms |
474968 KB |
Output is correct |
33 |
Correct |
206 ms |
475000 KB |
Output is correct |
34 |
Correct |
210 ms |
474968 KB |
Output is correct |
35 |
Correct |
204 ms |
474932 KB |
Output is correct |
36 |
Correct |
208 ms |
475112 KB |
Output is correct |
37 |
Correct |
206 ms |
475060 KB |
Output is correct |
38 |
Correct |
206 ms |
475016 KB |
Output is correct |
39 |
Correct |
207 ms |
475012 KB |
Output is correct |
40 |
Correct |
219 ms |
475036 KB |
Output is correct |
41 |
Correct |
215 ms |
474976 KB |
Output is correct |
42 |
Correct |
213 ms |
475060 KB |
Output is correct |
43 |
Correct |
211 ms |
475076 KB |
Output is correct |
44 |
Correct |
209 ms |
474996 KB |
Output is correct |
45 |
Correct |
210 ms |
474972 KB |
Output is correct |
46 |
Correct |
359 ms |
487388 KB |
Output is correct |
47 |
Correct |
452 ms |
494004 KB |
Output is correct |
48 |
Correct |
453 ms |
493940 KB |
Output is correct |
49 |
Correct |
446 ms |
494108 KB |
Output is correct |
50 |
Correct |
437 ms |
494120 KB |
Output is correct |
51 |
Correct |
434 ms |
494000 KB |
Output is correct |
52 |
Correct |
441 ms |
493976 KB |
Output is correct |
53 |
Correct |
358 ms |
494396 KB |
Output is correct |
54 |
Correct |
361 ms |
494396 KB |
Output is correct |
55 |
Correct |
367 ms |
494668 KB |
Output is correct |
56 |
Correct |
360 ms |
494344 KB |
Output is correct |
57 |
Correct |
463 ms |
493892 KB |
Output is correct |
58 |
Correct |
457 ms |
493992 KB |
Output is correct |
59 |
Correct |
459 ms |
493972 KB |
Output is correct |
60 |
Correct |
362 ms |
494280 KB |
Output is correct |
61 |
Correct |
356 ms |
494344 KB |
Output is correct |
62 |
Correct |
438 ms |
494012 KB |
Output is correct |
63 |
Correct |
433 ms |
494048 KB |
Output is correct |
64 |
Correct |
431 ms |
493912 KB |
Output is correct |
65 |
Correct |
361 ms |
494296 KB |
Output is correct |
66 |
Correct |
365 ms |
494604 KB |
Output is correct |
67 |
Correct |
438 ms |
493364 KB |
Output is correct |
68 |
Correct |
441 ms |
493932 KB |
Output is correct |
69 |
Correct |
435 ms |
494020 KB |
Output is correct |
70 |
Correct |
437 ms |
494012 KB |
Output is correct |
71 |
Correct |
453 ms |
494024 KB |
Output is correct |
72 |
Correct |
443 ms |
493876 KB |
Output is correct |
73 |
Correct |
442 ms |
493900 KB |
Output is correct |
74 |
Correct |
359 ms |
494436 KB |
Output is correct |
75 |
Correct |
372 ms |
494292 KB |
Output is correct |
76 |
Correct |
371 ms |
494708 KB |
Output is correct |
77 |
Correct |
371 ms |
494188 KB |
Output is correct |
78 |
Correct |
1370 ms |
493832 KB |
Output is correct |
79 |
Correct |
1386 ms |
494020 KB |
Output is correct |
80 |
Correct |
1433 ms |
494008 KB |
Output is correct |
81 |
Correct |
1447 ms |
494128 KB |
Output is correct |
82 |
Correct |
1414 ms |
493908 KB |
Output is correct |
83 |
Correct |
1441 ms |
494012 KB |
Output is correct |
84 |
Correct |
1537 ms |
493948 KB |
Output is correct |
85 |
Correct |
1317 ms |
494424 KB |
Output is correct |
86 |
Correct |
1277 ms |
494268 KB |
Output is correct |
87 |
Correct |
1319 ms |
494768 KB |
Output is correct |
88 |
Correct |
1074 ms |
494220 KB |
Output is correct |
89 |
Correct |
1299 ms |
494408 KB |
Output is correct |
90 |
Correct |
1177 ms |
494236 KB |
Output is correct |
91 |
Correct |
208 ms |
474568 KB |
Output is correct |
92 |
Correct |
217 ms |
475008 KB |
Output is correct |
93 |
Correct |
211 ms |
475040 KB |
Output is correct |
94 |
Correct |
445 ms |
494108 KB |
Output is correct |
95 |
Correct |
448 ms |
493932 KB |
Output is correct |
96 |
Correct |
473 ms |
494156 KB |
Output is correct |
97 |
Correct |
364 ms |
494276 KB |
Output is correct |
98 |
Correct |
365 ms |
494440 KB |
Output is correct |
99 |
Correct |
462 ms |
493904 KB |
Output is correct |
100 |
Correct |
443 ms |
494012 KB |
Output is correct |
101 |
Correct |
449 ms |
494040 KB |
Output is correct |
102 |
Correct |
376 ms |
494328 KB |
Output is correct |
103 |
Correct |
366 ms |
494640 KB |
Output is correct |
104 |
Correct |
212 ms |
475024 KB |
Output is correct |
105 |
Correct |
212 ms |
474960 KB |
Output is correct |
106 |
Correct |
209 ms |
475056 KB |
Output is correct |
107 |
Correct |
231 ms |
475124 KB |
Output is correct |
108 |
Correct |
219 ms |
474996 KB |
Output is correct |
109 |
Correct |
210 ms |
474968 KB |
Output is correct |
110 |
Correct |
211 ms |
475020 KB |
Output is correct |
111 |
Correct |
211 ms |
474964 KB |
Output is correct |
112 |
Correct |
209 ms |
474980 KB |
Output is correct |
113 |
Correct |
238 ms |
475036 KB |
Output is correct |
114 |
Correct |
559 ms |
479316 KB |
Output is correct |
115 |
Correct |
1319 ms |
493896 KB |
Output is correct |
116 |
Correct |
1417 ms |
493884 KB |
Output is correct |
117 |
Correct |
1203 ms |
494012 KB |
Output is correct |
118 |
Correct |
1367 ms |
493916 KB |
Output is correct |
119 |
Correct |
1433 ms |
494096 KB |
Output is correct |
120 |
Correct |
1284 ms |
493892 KB |
Output is correct |
121 |
Correct |
1283 ms |
494312 KB |
Output is correct |
122 |
Correct |
1181 ms |
494264 KB |
Output is correct |
123 |
Correct |
1291 ms |
494648 KB |
Output is correct |
124 |
Correct |
1063 ms |
494272 KB |
Output is correct |
125 |
Correct |
451 ms |
494064 KB |
Output is correct |
126 |
Correct |
448 ms |
494012 KB |
Output is correct |
127 |
Correct |
437 ms |
493964 KB |
Output is correct |
128 |
Correct |
362 ms |
494412 KB |
Output is correct |
129 |
Correct |
370 ms |
494592 KB |
Output is correct |
130 |
Correct |
440 ms |
493428 KB |
Output is correct |
131 |
Correct |
448 ms |
494016 KB |
Output is correct |
132 |
Correct |
447 ms |
494012 KB |
Output is correct |
133 |
Correct |
456 ms |
493884 KB |
Output is correct |
134 |
Correct |
468 ms |
493956 KB |
Output is correct |
135 |
Correct |
458 ms |
494012 KB |
Output is correct |
136 |
Correct |
446 ms |
493920 KB |
Output is correct |
137 |
Correct |
358 ms |
494476 KB |
Output is correct |
138 |
Correct |
362 ms |
494288 KB |
Output is correct |
139 |
Correct |
375 ms |
494600 KB |
Output is correct |
140 |
Correct |
369 ms |
494296 KB |
Output is correct |
141 |
Correct |
210 ms |
475132 KB |
Output is correct |
142 |
Correct |
207 ms |
475076 KB |
Output is correct |
143 |
Correct |
213 ms |
474956 KB |
Output is correct |
144 |
Correct |
211 ms |
475020 KB |
Output is correct |
145 |
Correct |
209 ms |
475080 KB |
Output is correct |
146 |
Correct |
209 ms |
474752 KB |
Output is correct |
147 |
Correct |
213 ms |
474960 KB |
Output is correct |
148 |
Correct |
209 ms |
475028 KB |
Output is correct |
149 |
Correct |
218 ms |
475052 KB |
Output is correct |
150 |
Correct |
218 ms |
474992 KB |
Output is correct |
151 |
Correct |
214 ms |
475068 KB |
Output is correct |
152 |
Correct |
213 ms |
475036 KB |
Output is correct |
153 |
Correct |
207 ms |
475080 KB |
Output is correct |
154 |
Correct |
212 ms |
475080 KB |
Output is correct |
155 |
Correct |
223 ms |
475092 KB |
Output is correct |
156 |
Correct |
206 ms |
475012 KB |
Output is correct |
157 |
Correct |
1291 ms |
491856 KB |
Output is correct |
158 |
Correct |
1616 ms |
493916 KB |
Output is correct |
159 |
Incorrect |
1726 ms |
493916 KB |
10307th lines differ - on the 1st token, expected: '1', found: '2' |
160 |
Halted |
0 ms |
0 KB |
- |