#include<bits/stdc++.h>
using namespace std;
#define fast ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define in insert
#define all(x) x.begin(),x.end()
#define pb push_back
#define eb emplace_back
#define ff first
#define ss second
#define int long long
typedef long long ll;
typedef vector<int> vi;
typedef set<int> si;
typedef multiset<int> msi;
typedef pair<int, int> pii;
typedef vector<pii> vpii;
template<typename T, typename U>
ostream & operator << (ostream &out, const pair<T, U> &c) {
out << c.first << ' ' << c.second;
return out;
}
template<typename T>
ostream & operator << (ostream &out, vector<T> &v) {
const int sz = v.size();
for (int i = 0; i < sz; i++) {
if (i) out << ' ';
out << v[i];
}
return out;
}
template<typename T>
istream & operator >> (istream &in, vector<T> &v) {
for (T &x : v) in >> x;
return in;
}
template<typename T>
void mxx(T &a, T b){if(b > a) a = b;}
template<typename T>
void mnn(T &a, T b){if(b < a) a = b;}
const int mxn = 3e5 + 10, bl = 3333, inf = 1e18 + 10, MX = 300000;
int a[mxn], cnt[mxn], le[mxn], ri[mxn], tot[mxn], ans[mxn];
void add(int x) {
int s = cnt[x];
//-+
// 2 1
// 2 0
// 1 0
// 1 1
if(tot[s] > 1 && tot[s + 1] == 0) {
if(ri[s] != inf) le[ri[s]] = s + 1;
ri[s + 1] = ri[s];
le[s + 1] = s;
ri[s] = s + 1;
} else if(tot[s] == 1 && tot[s + 1] == 0) {
ri[le[s]] = s + 1;
if(ri[s] != inf) le[ri[s]] = s + 1;
le[s + 1] = le[s];
ri[s + 1] = ri[s];
le[s] = 0;
ri[s] = inf;
} else if(tot[s] == 1 && tot[s + 1] >= 1) {
ri[le[s]] = s + 1;
le[s + 1] = le[s];
le[s] = 0;
ri[s] = inf;
}
tot[s]--;
tot[s + 1]++;
cnt[x]++;
}
void rem(int x) {
int s = cnt[x];
//+-
// 1 2
// 0 2
// 0 1
// 1 1
if(tot[s] > 1 && tot[s - 1] == 0) {
ri[le[s]] = s - 1;
le[s - 1] = le[s];
ri[s - 1] = s;
le[s] = s - 1;
} else if(tot[s] == 1 && tot[s - 1] == 0) {
if(ri[s] != inf) le[ri[s]] = s - 1;
ri[le[s]] = s - 1;
le[s - 1] = le[s];
ri[s - 1] = ri[s];
le[s] = 0;
ri[s] = inf;
} else if(tot[s] == 1 && tot[s - 1] >= 1) {
if(ri[s] != inf) le[ri[s]] = s - 1;
ri[s - 1] = ri[s];
le[s] = 0;
ri[s] = inf;
}
tot[s]--;
tot[s - 1]++;
cnt[x]--;
}
int solve(int n) {
// for(int i = 1; i <= m; i++) ret += (s - i * x) * (y + i * x);
auto get = [&](int s, int x, int y, int m) -> int {
if(m == 0) return 0;
int ret = s * y * m;
ret -= y * x * (m * (m + 1) / 2);
ret -= m * (m + 1) * (2 * m + 1) / 6 * x * x; // sus
ret += s * x * (m * (m + 1) / 2);
return ret;
};
int lsum = 0, rsum = 0, ret = 0, tp = 0;
for(int i = ri[0]; i < inf; i = ri[i]) {
int m = tot[i];
if(ri[i] == inf) m--;
int m1 = m / 2, m2 = m / 2;
if(m % 2 == 1) {
if(tp) m1++;
else m2++;
tp ^= 1;
}
ret += get(n - lsum, i, lsum, m1);
ret += get(n - rsum, i, rsum, m2);
lsum += m1 * i;
rsum += m2 * i;
}
return ret + n * (n + 1) / 2;
}
void go() {
int n, Q;
cin >> n >> Q;
for(int i = 1; i <= n; i++) {
cin >> a[i];
}
vector<pair<pair<int, int>, int>> q;
for(int i = 1; i <= Q; i++) {
int x, y; cin >> x >> y;
q.eb(make_pair(x, y), i);
}
sort(all(q), [&](const pair<pair<int, int>, int> &a, const pair<pair<int, int>, int> &b) {
if((a.ff.ff + bl - 1) / bl == (b.ff.ff + bl - 1) / bl) return a.ff.ss > b.ff.ss;
return (a.ff.ff + bl - 1) / bl < (b.ff.ff + bl - 1) / bl;
});
tot[0] = inf;
for(int i = 0; i <= MX; i++) {
le[i] = 0;
ri[i] = inf;
}
int l = 1, r = 1;
add(a[1]);
for(auto it : q) {
int L = it.ff.ff, R = it.ff.ss, id = it.ss;
while(r < R) add(a[++r]);
while(l > L) add(a[--l]);
while(r > R) rem(a[r--]);
while(l < L) rem(a[l++]);
assert(l == L && r == R);
ans[id] = solve(R - L + 1);
}
for(int i = 1; i <= Q; i++) {
cout << ans[i] << '\n';
}
}
signed main() {
// #ifndef ONO
// freopen("file.in", "r", stdin);
// freopen("file.out", "w", stdout);
// #endif
fast;
int t = 1;
// cin >> t;
while(t--) {
go();
}
return 0;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
3 ms |
5024 KB |
Output is correct |
2 |
Correct |
2 ms |
4948 KB |
Output is correct |
3 |
Correct |
2 ms |
4948 KB |
Output is correct |
4 |
Correct |
2 ms |
4948 KB |
Output is correct |
5 |
Correct |
2 ms |
4948 KB |
Output is correct |
6 |
Correct |
2 ms |
4948 KB |
Output is correct |
7 |
Correct |
2 ms |
4948 KB |
Output is correct |
8 |
Correct |
2 ms |
4948 KB |
Output is correct |
9 |
Correct |
2 ms |
4948 KB |
Output is correct |
10 |
Correct |
2 ms |
4948 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
2 ms |
4948 KB |
Output is correct |
2 |
Correct |
2 ms |
4948 KB |
Output is correct |
3 |
Correct |
3 ms |
5076 KB |
Output is correct |
4 |
Correct |
8 ms |
6028 KB |
Output is correct |
5 |
Correct |
12 ms |
7180 KB |
Output is correct |
6 |
Correct |
17 ms |
7764 KB |
Output is correct |
7 |
Correct |
25 ms |
8624 KB |
Output is correct |
8 |
Correct |
16 ms |
7764 KB |
Output is correct |
9 |
Correct |
17 ms |
7764 KB |
Output is correct |
10 |
Correct |
18 ms |
8148 KB |
Output is correct |
11 |
Correct |
17 ms |
7892 KB |
Output is correct |
12 |
Correct |
17 ms |
7792 KB |
Output is correct |
13 |
Correct |
17 ms |
7764 KB |
Output is correct |
14 |
Correct |
17 ms |
8048 KB |
Output is correct |
15 |
Correct |
19 ms |
7808 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
2 ms |
4948 KB |
Output is correct |
2 |
Correct |
2 ms |
4948 KB |
Output is correct |
3 |
Correct |
3 ms |
5076 KB |
Output is correct |
4 |
Correct |
8 ms |
6028 KB |
Output is correct |
5 |
Correct |
12 ms |
7180 KB |
Output is correct |
6 |
Correct |
17 ms |
7764 KB |
Output is correct |
7 |
Correct |
25 ms |
8624 KB |
Output is correct |
8 |
Correct |
16 ms |
7764 KB |
Output is correct |
9 |
Correct |
17 ms |
7764 KB |
Output is correct |
10 |
Correct |
18 ms |
8148 KB |
Output is correct |
11 |
Correct |
17 ms |
7892 KB |
Output is correct |
12 |
Correct |
17 ms |
7792 KB |
Output is correct |
13 |
Correct |
17 ms |
7764 KB |
Output is correct |
14 |
Correct |
17 ms |
8048 KB |
Output is correct |
15 |
Correct |
19 ms |
7808 KB |
Output is correct |
16 |
Correct |
2 ms |
4948 KB |
Output is correct |
17 |
Correct |
2 ms |
4948 KB |
Output is correct |
18 |
Correct |
2 ms |
5008 KB |
Output is correct |
19 |
Correct |
7 ms |
5948 KB |
Output is correct |
20 |
Correct |
11 ms |
6740 KB |
Output is correct |
21 |
Correct |
17 ms |
7800 KB |
Output is correct |
22 |
Correct |
17 ms |
7632 KB |
Output is correct |
23 |
Correct |
18 ms |
7764 KB |
Output is correct |
24 |
Correct |
17 ms |
7604 KB |
Output is correct |
25 |
Correct |
18 ms |
7704 KB |
Output is correct |
26 |
Correct |
17 ms |
7608 KB |
Output is correct |
27 |
Correct |
17 ms |
7716 KB |
Output is correct |
28 |
Correct |
17 ms |
7976 KB |
Output is correct |
29 |
Correct |
20 ms |
7676 KB |
Output is correct |
30 |
Correct |
17 ms |
7680 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
2 ms |
4948 KB |
Output is correct |
2 |
Correct |
2 ms |
4948 KB |
Output is correct |
3 |
Correct |
3 ms |
5076 KB |
Output is correct |
4 |
Correct |
8 ms |
6028 KB |
Output is correct |
5 |
Correct |
12 ms |
7180 KB |
Output is correct |
6 |
Correct |
17 ms |
7764 KB |
Output is correct |
7 |
Correct |
25 ms |
8624 KB |
Output is correct |
8 |
Correct |
16 ms |
7764 KB |
Output is correct |
9 |
Correct |
17 ms |
7764 KB |
Output is correct |
10 |
Correct |
18 ms |
8148 KB |
Output is correct |
11 |
Correct |
17 ms |
7892 KB |
Output is correct |
12 |
Correct |
17 ms |
7792 KB |
Output is correct |
13 |
Correct |
17 ms |
7764 KB |
Output is correct |
14 |
Correct |
17 ms |
8048 KB |
Output is correct |
15 |
Correct |
19 ms |
7808 KB |
Output is correct |
16 |
Correct |
2 ms |
4948 KB |
Output is correct |
17 |
Correct |
2 ms |
4948 KB |
Output is correct |
18 |
Correct |
2 ms |
5008 KB |
Output is correct |
19 |
Correct |
7 ms |
5948 KB |
Output is correct |
20 |
Correct |
11 ms |
6740 KB |
Output is correct |
21 |
Correct |
17 ms |
7800 KB |
Output is correct |
22 |
Correct |
17 ms |
7632 KB |
Output is correct |
23 |
Correct |
18 ms |
7764 KB |
Output is correct |
24 |
Correct |
17 ms |
7604 KB |
Output is correct |
25 |
Correct |
18 ms |
7704 KB |
Output is correct |
26 |
Correct |
17 ms |
7608 KB |
Output is correct |
27 |
Correct |
17 ms |
7716 KB |
Output is correct |
28 |
Correct |
17 ms |
7976 KB |
Output is correct |
29 |
Correct |
20 ms |
7676 KB |
Output is correct |
30 |
Correct |
17 ms |
7680 KB |
Output is correct |
31 |
Correct |
2 ms |
4948 KB |
Output is correct |
32 |
Correct |
2 ms |
4948 KB |
Output is correct |
33 |
Correct |
2 ms |
4948 KB |
Output is correct |
34 |
Correct |
2 ms |
5076 KB |
Output is correct |
35 |
Correct |
3 ms |
5076 KB |
Output is correct |
36 |
Correct |
2 ms |
5076 KB |
Output is correct |
37 |
Correct |
5 ms |
5332 KB |
Output is correct |
38 |
Correct |
6 ms |
5332 KB |
Output is correct |
39 |
Correct |
10 ms |
5728 KB |
Output is correct |
40 |
Correct |
14 ms |
6568 KB |
Output is correct |
41 |
Correct |
19 ms |
7380 KB |
Output is correct |
42 |
Correct |
18 ms |
7372 KB |
Output is correct |
43 |
Correct |
18 ms |
7348 KB |
Output is correct |
44 |
Correct |
19 ms |
7380 KB |
Output is correct |
45 |
Correct |
19 ms |
7380 KB |
Output is correct |
46 |
Correct |
21 ms |
7304 KB |
Output is correct |
47 |
Correct |
19 ms |
7412 KB |
Output is correct |
48 |
Correct |
18 ms |
7416 KB |
Output is correct |
49 |
Correct |
19 ms |
7380 KB |
Output is correct |
50 |
Correct |
19 ms |
7380 KB |
Output is correct |
51 |
Correct |
20 ms |
7352 KB |
Output is correct |
52 |
Correct |
19 ms |
7380 KB |
Output is correct |
53 |
Correct |
21 ms |
7320 KB |
Output is correct |
54 |
Correct |
19 ms |
7388 KB |
Output is correct |
55 |
Correct |
19 ms |
7376 KB |
Output is correct |
56 |
Correct |
19 ms |
7316 KB |
Output is correct |
57 |
Correct |
22 ms |
7380 KB |
Output is correct |
58 |
Correct |
19 ms |
7380 KB |
Output is correct |
59 |
Correct |
22 ms |
7380 KB |
Output is correct |
60 |
Correct |
19 ms |
7324 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
3 ms |
5024 KB |
Output is correct |
2 |
Correct |
2 ms |
4948 KB |
Output is correct |
3 |
Correct |
2 ms |
4948 KB |
Output is correct |
4 |
Correct |
2 ms |
4948 KB |
Output is correct |
5 |
Correct |
2 ms |
4948 KB |
Output is correct |
6 |
Correct |
2 ms |
4948 KB |
Output is correct |
7 |
Correct |
2 ms |
4948 KB |
Output is correct |
8 |
Correct |
2 ms |
4948 KB |
Output is correct |
9 |
Correct |
2 ms |
4948 KB |
Output is correct |
10 |
Correct |
2 ms |
4948 KB |
Output is correct |
11 |
Correct |
2 ms |
4948 KB |
Output is correct |
12 |
Correct |
2 ms |
4948 KB |
Output is correct |
13 |
Correct |
3 ms |
5076 KB |
Output is correct |
14 |
Correct |
8 ms |
6028 KB |
Output is correct |
15 |
Correct |
12 ms |
7180 KB |
Output is correct |
16 |
Correct |
17 ms |
7764 KB |
Output is correct |
17 |
Correct |
25 ms |
8624 KB |
Output is correct |
18 |
Correct |
16 ms |
7764 KB |
Output is correct |
19 |
Correct |
17 ms |
7764 KB |
Output is correct |
20 |
Correct |
18 ms |
8148 KB |
Output is correct |
21 |
Correct |
17 ms |
7892 KB |
Output is correct |
22 |
Correct |
17 ms |
7792 KB |
Output is correct |
23 |
Correct |
17 ms |
7764 KB |
Output is correct |
24 |
Correct |
17 ms |
8048 KB |
Output is correct |
25 |
Correct |
19 ms |
7808 KB |
Output is correct |
26 |
Correct |
2 ms |
4948 KB |
Output is correct |
27 |
Correct |
2 ms |
4948 KB |
Output is correct |
28 |
Correct |
2 ms |
5008 KB |
Output is correct |
29 |
Correct |
7 ms |
5948 KB |
Output is correct |
30 |
Correct |
11 ms |
6740 KB |
Output is correct |
31 |
Correct |
17 ms |
7800 KB |
Output is correct |
32 |
Correct |
17 ms |
7632 KB |
Output is correct |
33 |
Correct |
18 ms |
7764 KB |
Output is correct |
34 |
Correct |
17 ms |
7604 KB |
Output is correct |
35 |
Correct |
18 ms |
7704 KB |
Output is correct |
36 |
Correct |
17 ms |
7608 KB |
Output is correct |
37 |
Correct |
17 ms |
7716 KB |
Output is correct |
38 |
Correct |
17 ms |
7976 KB |
Output is correct |
39 |
Correct |
20 ms |
7676 KB |
Output is correct |
40 |
Correct |
17 ms |
7680 KB |
Output is correct |
41 |
Correct |
2 ms |
4948 KB |
Output is correct |
42 |
Correct |
2 ms |
4948 KB |
Output is correct |
43 |
Correct |
2 ms |
4948 KB |
Output is correct |
44 |
Correct |
2 ms |
5076 KB |
Output is correct |
45 |
Correct |
3 ms |
5076 KB |
Output is correct |
46 |
Correct |
2 ms |
5076 KB |
Output is correct |
47 |
Correct |
5 ms |
5332 KB |
Output is correct |
48 |
Correct |
6 ms |
5332 KB |
Output is correct |
49 |
Correct |
10 ms |
5728 KB |
Output is correct |
50 |
Correct |
14 ms |
6568 KB |
Output is correct |
51 |
Correct |
19 ms |
7380 KB |
Output is correct |
52 |
Correct |
18 ms |
7372 KB |
Output is correct |
53 |
Correct |
18 ms |
7348 KB |
Output is correct |
54 |
Correct |
19 ms |
7380 KB |
Output is correct |
55 |
Correct |
19 ms |
7380 KB |
Output is correct |
56 |
Correct |
21 ms |
7304 KB |
Output is correct |
57 |
Correct |
19 ms |
7412 KB |
Output is correct |
58 |
Correct |
18 ms |
7416 KB |
Output is correct |
59 |
Correct |
19 ms |
7380 KB |
Output is correct |
60 |
Correct |
19 ms |
7380 KB |
Output is correct |
61 |
Correct |
20 ms |
7352 KB |
Output is correct |
62 |
Correct |
19 ms |
7380 KB |
Output is correct |
63 |
Correct |
21 ms |
7320 KB |
Output is correct |
64 |
Correct |
19 ms |
7388 KB |
Output is correct |
65 |
Correct |
19 ms |
7376 KB |
Output is correct |
66 |
Correct |
19 ms |
7316 KB |
Output is correct |
67 |
Correct |
22 ms |
7380 KB |
Output is correct |
68 |
Correct |
19 ms |
7380 KB |
Output is correct |
69 |
Correct |
22 ms |
7380 KB |
Output is correct |
70 |
Correct |
19 ms |
7324 KB |
Output is correct |
71 |
Correct |
5 ms |
5332 KB |
Output is correct |
72 |
Correct |
6 ms |
5332 KB |
Output is correct |
73 |
Correct |
5 ms |
5332 KB |
Output is correct |
74 |
Correct |
5 ms |
5332 KB |
Output is correct |
75 |
Correct |
5 ms |
5332 KB |
Output is correct |
76 |
Correct |
7 ms |
5844 KB |
Output is correct |
77 |
Correct |
8 ms |
5844 KB |
Output is correct |
78 |
Correct |
8 ms |
5844 KB |
Output is correct |
79 |
Correct |
7 ms |
5860 KB |
Output is correct |
80 |
Correct |
8 ms |
5812 KB |
Output is correct |
81 |
Correct |
14 ms |
6648 KB |
Output is correct |
82 |
Correct |
13 ms |
6612 KB |
Output is correct |
83 |
Correct |
15 ms |
6680 KB |
Output is correct |
84 |
Correct |
13 ms |
6576 KB |
Output is correct |
85 |
Correct |
13 ms |
6604 KB |
Output is correct |
86 |
Correct |
14 ms |
6680 KB |
Output is correct |
87 |
Correct |
15 ms |
6740 KB |
Output is correct |
88 |
Correct |
17 ms |
6668 KB |
Output is correct |
89 |
Correct |
18 ms |
6776 KB |
Output is correct |
90 |
Correct |
15 ms |
6736 KB |
Output is correct |
91 |
Correct |
22 ms |
8136 KB |
Output is correct |
92 |
Correct |
20 ms |
8088 KB |
Output is correct |
93 |
Correct |
21 ms |
8124 KB |
Output is correct |
94 |
Correct |
21 ms |
8052 KB |
Output is correct |
95 |
Correct |
21 ms |
8072 KB |
Output is correct |
96 |
Correct |
23 ms |
8852 KB |
Output is correct |
97 |
Correct |
24 ms |
8896 KB |
Output is correct |
98 |
Correct |
23 ms |
8820 KB |
Output is correct |
99 |
Correct |
24 ms |
8860 KB |
Output is correct |
100 |
Correct |
32 ms |
8908 KB |
Output is correct |
101 |
Correct |
26 ms |
8812 KB |
Output is correct |
102 |
Correct |
24 ms |
9020 KB |
Output is correct |
103 |
Correct |
23 ms |
8868 KB |
Output is correct |
104 |
Correct |
23 ms |
8860 KB |
Output is correct |
105 |
Correct |
23 ms |
8896 KB |
Output is correct |
106 |
Correct |
23 ms |
9324 KB |
Output is correct |
107 |
Correct |
23 ms |
9260 KB |
Output is correct |
108 |
Correct |
23 ms |
9244 KB |
Output is correct |
109 |
Correct |
28 ms |
9300 KB |
Output is correct |
110 |
Correct |
23 ms |
9300 KB |
Output is correct |
111 |
Correct |
24 ms |
9248 KB |
Output is correct |
112 |
Correct |
23 ms |
9220 KB |
Output is correct |
113 |
Correct |
23 ms |
9300 KB |
Output is correct |
114 |
Correct |
23 ms |
9240 KB |
Output is correct |
115 |
Correct |
23 ms |
9272 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
3 ms |
5024 KB |
Output is correct |
2 |
Correct |
2 ms |
4948 KB |
Output is correct |
3 |
Correct |
2 ms |
4948 KB |
Output is correct |
4 |
Correct |
2 ms |
4948 KB |
Output is correct |
5 |
Correct |
2 ms |
4948 KB |
Output is correct |
6 |
Correct |
2 ms |
4948 KB |
Output is correct |
7 |
Correct |
2 ms |
4948 KB |
Output is correct |
8 |
Correct |
2 ms |
4948 KB |
Output is correct |
9 |
Correct |
2 ms |
4948 KB |
Output is correct |
10 |
Correct |
2 ms |
4948 KB |
Output is correct |
11 |
Correct |
2 ms |
4948 KB |
Output is correct |
12 |
Correct |
2 ms |
4948 KB |
Output is correct |
13 |
Correct |
3 ms |
5076 KB |
Output is correct |
14 |
Correct |
8 ms |
6028 KB |
Output is correct |
15 |
Correct |
12 ms |
7180 KB |
Output is correct |
16 |
Correct |
17 ms |
7764 KB |
Output is correct |
17 |
Correct |
25 ms |
8624 KB |
Output is correct |
18 |
Correct |
16 ms |
7764 KB |
Output is correct |
19 |
Correct |
17 ms |
7764 KB |
Output is correct |
20 |
Correct |
18 ms |
8148 KB |
Output is correct |
21 |
Correct |
17 ms |
7892 KB |
Output is correct |
22 |
Correct |
17 ms |
7792 KB |
Output is correct |
23 |
Correct |
17 ms |
7764 KB |
Output is correct |
24 |
Correct |
17 ms |
8048 KB |
Output is correct |
25 |
Correct |
19 ms |
7808 KB |
Output is correct |
26 |
Correct |
2 ms |
4948 KB |
Output is correct |
27 |
Correct |
2 ms |
4948 KB |
Output is correct |
28 |
Correct |
2 ms |
5008 KB |
Output is correct |
29 |
Correct |
7 ms |
5948 KB |
Output is correct |
30 |
Correct |
11 ms |
6740 KB |
Output is correct |
31 |
Correct |
17 ms |
7800 KB |
Output is correct |
32 |
Correct |
17 ms |
7632 KB |
Output is correct |
33 |
Correct |
18 ms |
7764 KB |
Output is correct |
34 |
Correct |
17 ms |
7604 KB |
Output is correct |
35 |
Correct |
18 ms |
7704 KB |
Output is correct |
36 |
Correct |
17 ms |
7608 KB |
Output is correct |
37 |
Correct |
17 ms |
7716 KB |
Output is correct |
38 |
Correct |
17 ms |
7976 KB |
Output is correct |
39 |
Correct |
20 ms |
7676 KB |
Output is correct |
40 |
Correct |
17 ms |
7680 KB |
Output is correct |
41 |
Correct |
2 ms |
4948 KB |
Output is correct |
42 |
Correct |
2 ms |
4948 KB |
Output is correct |
43 |
Correct |
2 ms |
4948 KB |
Output is correct |
44 |
Correct |
2 ms |
5076 KB |
Output is correct |
45 |
Correct |
3 ms |
5076 KB |
Output is correct |
46 |
Correct |
2 ms |
5076 KB |
Output is correct |
47 |
Correct |
5 ms |
5332 KB |
Output is correct |
48 |
Correct |
6 ms |
5332 KB |
Output is correct |
49 |
Correct |
10 ms |
5728 KB |
Output is correct |
50 |
Correct |
14 ms |
6568 KB |
Output is correct |
51 |
Correct |
19 ms |
7380 KB |
Output is correct |
52 |
Correct |
18 ms |
7372 KB |
Output is correct |
53 |
Correct |
18 ms |
7348 KB |
Output is correct |
54 |
Correct |
19 ms |
7380 KB |
Output is correct |
55 |
Correct |
19 ms |
7380 KB |
Output is correct |
56 |
Correct |
21 ms |
7304 KB |
Output is correct |
57 |
Correct |
19 ms |
7412 KB |
Output is correct |
58 |
Correct |
18 ms |
7416 KB |
Output is correct |
59 |
Correct |
19 ms |
7380 KB |
Output is correct |
60 |
Correct |
19 ms |
7380 KB |
Output is correct |
61 |
Correct |
20 ms |
7352 KB |
Output is correct |
62 |
Correct |
19 ms |
7380 KB |
Output is correct |
63 |
Correct |
21 ms |
7320 KB |
Output is correct |
64 |
Correct |
19 ms |
7388 KB |
Output is correct |
65 |
Correct |
19 ms |
7376 KB |
Output is correct |
66 |
Correct |
19 ms |
7316 KB |
Output is correct |
67 |
Correct |
22 ms |
7380 KB |
Output is correct |
68 |
Correct |
19 ms |
7380 KB |
Output is correct |
69 |
Correct |
22 ms |
7380 KB |
Output is correct |
70 |
Correct |
19 ms |
7324 KB |
Output is correct |
71 |
Correct |
5 ms |
5332 KB |
Output is correct |
72 |
Correct |
6 ms |
5332 KB |
Output is correct |
73 |
Correct |
5 ms |
5332 KB |
Output is correct |
74 |
Correct |
5 ms |
5332 KB |
Output is correct |
75 |
Correct |
5 ms |
5332 KB |
Output is correct |
76 |
Correct |
7 ms |
5844 KB |
Output is correct |
77 |
Correct |
8 ms |
5844 KB |
Output is correct |
78 |
Correct |
8 ms |
5844 KB |
Output is correct |
79 |
Correct |
7 ms |
5860 KB |
Output is correct |
80 |
Correct |
8 ms |
5812 KB |
Output is correct |
81 |
Correct |
14 ms |
6648 KB |
Output is correct |
82 |
Correct |
13 ms |
6612 KB |
Output is correct |
83 |
Correct |
15 ms |
6680 KB |
Output is correct |
84 |
Correct |
13 ms |
6576 KB |
Output is correct |
85 |
Correct |
13 ms |
6604 KB |
Output is correct |
86 |
Correct |
14 ms |
6680 KB |
Output is correct |
87 |
Correct |
15 ms |
6740 KB |
Output is correct |
88 |
Correct |
17 ms |
6668 KB |
Output is correct |
89 |
Correct |
18 ms |
6776 KB |
Output is correct |
90 |
Correct |
15 ms |
6736 KB |
Output is correct |
91 |
Correct |
22 ms |
8136 KB |
Output is correct |
92 |
Correct |
20 ms |
8088 KB |
Output is correct |
93 |
Correct |
21 ms |
8124 KB |
Output is correct |
94 |
Correct |
21 ms |
8052 KB |
Output is correct |
95 |
Correct |
21 ms |
8072 KB |
Output is correct |
96 |
Correct |
23 ms |
8852 KB |
Output is correct |
97 |
Correct |
24 ms |
8896 KB |
Output is correct |
98 |
Correct |
23 ms |
8820 KB |
Output is correct |
99 |
Correct |
24 ms |
8860 KB |
Output is correct |
100 |
Correct |
32 ms |
8908 KB |
Output is correct |
101 |
Correct |
26 ms |
8812 KB |
Output is correct |
102 |
Correct |
24 ms |
9020 KB |
Output is correct |
103 |
Correct |
23 ms |
8868 KB |
Output is correct |
104 |
Correct |
23 ms |
8860 KB |
Output is correct |
105 |
Correct |
23 ms |
8896 KB |
Output is correct |
106 |
Correct |
23 ms |
9324 KB |
Output is correct |
107 |
Correct |
23 ms |
9260 KB |
Output is correct |
108 |
Correct |
23 ms |
9244 KB |
Output is correct |
109 |
Correct |
28 ms |
9300 KB |
Output is correct |
110 |
Correct |
23 ms |
9300 KB |
Output is correct |
111 |
Correct |
24 ms |
9248 KB |
Output is correct |
112 |
Correct |
23 ms |
9220 KB |
Output is correct |
113 |
Correct |
23 ms |
9300 KB |
Output is correct |
114 |
Correct |
23 ms |
9240 KB |
Output is correct |
115 |
Correct |
23 ms |
9272 KB |
Output is correct |
116 |
Correct |
390 ms |
7204 KB |
Output is correct |
117 |
Correct |
476 ms |
7204 KB |
Output is correct |
118 |
Correct |
480 ms |
7656 KB |
Output is correct |
119 |
Correct |
415 ms |
7648 KB |
Output is correct |
120 |
Correct |
267 ms |
7648 KB |
Output is correct |
121 |
Correct |
393 ms |
8164 KB |
Output is correct |
122 |
Correct |
292 ms |
8052 KB |
Output is correct |
123 |
Correct |
592 ms |
9080 KB |
Output is correct |
124 |
Correct |
265 ms |
8972 KB |
Output is correct |
125 |
Correct |
235 ms |
9016 KB |
Output is correct |
126 |
Correct |
844 ms |
9644 KB |
Output is correct |
127 |
Correct |
829 ms |
9640 KB |
Output is correct |
128 |
Correct |
834 ms |
9652 KB |
Output is correct |
129 |
Correct |
805 ms |
9636 KB |
Output is correct |
130 |
Correct |
818 ms |
9632 KB |
Output is correct |
131 |
Correct |
941 ms |
9752 KB |
Output is correct |
132 |
Correct |
937 ms |
9748 KB |
Output is correct |
133 |
Correct |
927 ms |
9748 KB |
Output is correct |
134 |
Correct |
945 ms |
9876 KB |
Output is correct |
135 |
Correct |
944 ms |
9644 KB |
Output is correct |
136 |
Correct |
945 ms |
9812 KB |
Output is correct |
137 |
Correct |
938 ms |
9756 KB |
Output is correct |
138 |
Correct |
967 ms |
9772 KB |
Output is correct |
139 |
Correct |
938 ms |
9800 KB |
Output is correct |
140 |
Correct |
950 ms |
9764 KB |
Output is correct |
141 |
Correct |
761 ms |
9752 KB |
Output is correct |
142 |
Correct |
796 ms |
9736 KB |
Output is correct |
143 |
Correct |
854 ms |
9744 KB |
Output is correct |
144 |
Correct |
813 ms |
9760 KB |
Output is correct |
145 |
Correct |
795 ms |
9740 KB |
Output is correct |
146 |
Correct |
346 ms |
9760 KB |
Output is correct |
147 |
Correct |
365 ms |
9760 KB |
Output is correct |
148 |
Correct |
353 ms |
9760 KB |
Output is correct |
149 |
Correct |
372 ms |
9764 KB |
Output is correct |
150 |
Correct |
348 ms |
9760 KB |
Output is correct |
151 |
Correct |
300 ms |
9796 KB |
Output is correct |
152 |
Correct |
302 ms |
9796 KB |
Output is correct |
153 |
Correct |
301 ms |
9920 KB |
Output is correct |
154 |
Correct |
294 ms |
9860 KB |
Output is correct |
155 |
Correct |
286 ms |
9792 KB |
Output is correct |
156 |
Correct |
774 ms |
10328 KB |
Output is correct |
157 |
Correct |
792 ms |
10376 KB |
Output is correct |
158 |
Correct |
737 ms |
10240 KB |
Output is correct |
159 |
Correct |
757 ms |
10216 KB |
Output is correct |
160 |
Correct |
732 ms |
10244 KB |
Output is correct |
161 |
Correct |
687 ms |
10340 KB |
Output is correct |
162 |
Correct |
656 ms |
10204 KB |
Output is correct |
163 |
Correct |
654 ms |
10152 KB |
Output is correct |
164 |
Correct |
649 ms |
10196 KB |
Output is correct |
165 |
Correct |
641 ms |
10132 KB |
Output is correct |
166 |
Correct |
895 ms |
9872 KB |
Output is correct |
167 |
Correct |
905 ms |
9812 KB |
Output is correct |
168 |
Correct |
904 ms |
9828 KB |
Output is correct |
169 |
Correct |
913 ms |
9876 KB |
Output is correct |
170 |
Correct |
900 ms |
9836 KB |
Output is correct |
171 |
Correct |
816 ms |
9708 KB |
Output is correct |
172 |
Correct |
823 ms |
9700 KB |
Output is correct |
173 |
Correct |
804 ms |
9696 KB |
Output is correct |
174 |
Correct |
797 ms |
9784 KB |
Output is correct |
175 |
Correct |
868 ms |
9760 KB |
Output is correct |