#include <bits/stdc++.h>
#define int long long
using namespace std;
const int nmax = 3e5;
const int c = 150;
const int bsize = 550;
struct qry
{
int st, dr, poz;
};
int n,q;
int v[nmax + 5];
int fr[nmax + 5];
int nrfr[nmax + 5];
int st[nmax + 5], dr[nmax + 5];
vector<int> l, h;
int sp[c + 5][nmax + 5];
vector<qry> B[bsize + 5];
bool sel[nmax + 5];
int sum_prod(int p, int st, int dr)
{
if(st - p <= 0)
{
return sp[p][dr];
}
return sp[p][dr] - sp[p][st - p];
}
int solve_heavy(int x, int y)
{
deque<int> d;
for(int i=0; i<h.size(); i++)
{
if(i % 2 == 0)
{
d.push_back(h[i]);
}
else
{
d.push_front(h[i]);
}
}
int sum_st = 0, sum_dr = 0;
for(int i=1; i<=c; i++)
{
sum_st += st[i] * i;
sum_dr += dr[i] * i;
}
for(auto it : d)
{
sum_dr += it;
}
int rez = 0;
for(auto it : d)
{
sum_dr -= it;
rez += 1LL * (y - x + 1) * (y - x + 2) / 2;
rez -= 1LL * sum_st * (sum_st + 1) / 2;
rez -= 1LL * sum_dr * (sum_dr + 1) / 2;
sum_st += it;
}
return rez;
}
int solve_light(int x, int y)
{
int rez = 0;
int sum_dr = 0, sum_st = 0;
for(int i=1; i<=c; i++)
{
sum_dr += dr[i] * i;
sum_dr += st[i] * i;
}
for(auto it : h)
{
sum_dr += it;
}
for(int i=1; i<=c; i++)
{
int cnt = st[i];
if(cnt)
{
rez += 1LL * (1LL * (y - x + 1) * (y - x + 2) / 2) * cnt;
rez -= sum_prod(i, sum_st, sum_st + i * (cnt - 1));
rez -= sum_prod(i, sum_dr - i * cnt, sum_dr - i);
sum_st += st[i] * i;
sum_dr -= st[i] * i;
}
}
sum_dr = 0, sum_st = 0;
for(int i=1; i<=c; i++)
{
sum_st += st[i] * i;
sum_st += dr[i] * i;
}
for(auto it : h)
{
sum_st += it;
}
for(int i=1; i<=c; i++)
{
int cnt = dr[i];
if(cnt)
{
rez += 1LL * (1LL * (y - x + 1) * (y - x + 2) / 2) * cnt;
rez -= sum_prod(i, sum_st - i * cnt, sum_st - i);
rez -= sum_prod(i, sum_dr, sum_dr + i * (cnt - 1));
sum_st -= dr[i] * i;
sum_dr += dr[i] * i;
}
}
return rez;
}
int query(int x, int y)
{
int nr = h.size();
for(int i=c; i>=1; i--)
{
if(nrfr[i]==0)
{
st[i] = dr[i] = 0;
continue;
}
if(nrfr[i] % 2 == 0)
{
st[i] = dr[i] = nrfr[i] / 2;
}
else
{
if(nr % 2 == 0)
{
st[i] = nrfr[i] / 2;
dr[i] = nrfr[i] / 2 + 1;
}
else
{
st[i] = nrfr[i] / 2 + 1;
dr[i] = nrfr[i] / 2;
}
}
nr += nrfr[i];
}
int rez = 0;
rez += solve_heavy(x,y);
rez += solve_light(x,y);
return rez;
}
void Add(int val)
{
--nrfr[fr[val]];
++fr[val];
++nrfr[fr[val]];
if(fr[val] == c + 1 && !sel[val])
{
l.push_back(val);
sel[val] = true;
}
}
void Remove(int val)
{
--nrfr[fr[val]];
--fr[val];
++nrfr[fr[val]];
}
void build_h()
{
vector<int> aux;
h.clear();
for(auto it : l)
{
if(fr[it] > c)
{
aux.push_back(it);
h.push_back(fr[it]);
}
}
for(auto it : l)
{
sel[it] = false;
}
l = aux;
for(auto it : l)
{
sel[it] = true;
}
sort(h.begin(),h.end(),greater<int>());
}
void precalc()
{
for(int p=1; p<=c; p++)
{
for(int i=1; i<=n; i++)
{
sp[p][i] = 1LL * i * (i + 1) / 2;
if(i - p > 0)
{
sp[p][i] += sp[p][i - p];
}
}
}
}
int get_bucket(int poz)
{
return (poz - 1) / bsize + 1;
}
bool cmp(qry a, qry b)
{
return (a.dr < b.dr);
}
int rez[nmax + 5];
signed main()
{
ios::sync_with_stdio(false);
cin.tie(0);
#ifdef home
freopen("nr.in","r",stdin);
freopen("nr.out","w",stdout);
#endif // home
cin>>n>>q;
for(int i=1; i<=n; i++)
{
cin>>v[i];
}
precalc();
for(int i=1; i<=q; i++)
{
qry x;
cin>>x.st>>x.dr;
x.poz = i;
int bucket = get_bucket(x.st);
B[bucket].push_back(x);
}
for(int b=1; b<=bsize+1; b++)
{
if(!B[b].size())
{
continue;
}
nrfr[0] = n;
l.clear();
for(int i=1; i<=nmax; i++)
{
nrfr[i] = 0;
fr[i] = 0;
sel[i] = false;
}
sort(B[b].begin(), B[b].end(),cmp);
int last_st = B[b].front().st, last_dr = B[b].front().st - 1;
for(auto it : B[b])
{
int st = it.st;
int dr = it.dr;
int poz = it.poz;
for(int i=last_dr+1; i<=dr; i++)
{
Add(v[i]);
}
if(last_st < st)
{
for(int i=last_st; i<st; i++)
{
Remove(v[i]);
}
}
else
{
for(int i=st; i<last_st; i++)
{
Add(v[i]);
}
}
build_h();
rez[poz] = query(st,dr);
last_st = st, last_dr = dr;
}
}
for(int i=1; i<=q; i++)
{
cout<<rez[i]<<'\n';
}
return 0;
}
Compilation message
diversity.cpp: In function 'long long int solve_heavy(long long int, long long int)':
diversity.cpp:44:19: warning: comparison of integer expressions of different signedness: 'long long int' and 'std::vector<long long int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
44 | for(int i=0; i<h.size(); i++)
| ~^~~~~~~~~
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
31 ms |
322388 KB |
Output is correct |
2 |
Correct |
32 ms |
322384 KB |
Output is correct |
3 |
Correct |
31 ms |
322388 KB |
Output is correct |
4 |
Correct |
31 ms |
322672 KB |
Output is correct |
5 |
Correct |
30 ms |
322388 KB |
Output is correct |
6 |
Correct |
30 ms |
322388 KB |
Output is correct |
7 |
Correct |
30 ms |
322604 KB |
Output is correct |
8 |
Correct |
30 ms |
322388 KB |
Output is correct |
9 |
Correct |
30 ms |
322388 KB |
Output is correct |
10 |
Correct |
30 ms |
322384 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
31 ms |
322648 KB |
Output is correct |
2 |
Correct |
31 ms |
326460 KB |
Output is correct |
3 |
Correct |
33 ms |
338908 KB |
Output is correct |
4 |
Correct |
53 ms |
367700 KB |
Output is correct |
5 |
Correct |
70 ms |
367956 KB |
Output is correct |
6 |
Correct |
91 ms |
371032 KB |
Output is correct |
7 |
Correct |
94 ms |
371088 KB |
Output is correct |
8 |
Correct |
88 ms |
371020 KB |
Output is correct |
9 |
Correct |
90 ms |
371024 KB |
Output is correct |
10 |
Correct |
90 ms |
371108 KB |
Output is correct |
11 |
Correct |
89 ms |
371028 KB |
Output is correct |
12 |
Correct |
92 ms |
370912 KB |
Output is correct |
13 |
Correct |
89 ms |
370868 KB |
Output is correct |
14 |
Correct |
90 ms |
370948 KB |
Output is correct |
15 |
Correct |
89 ms |
371056 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
31 ms |
322648 KB |
Output is correct |
2 |
Correct |
31 ms |
326460 KB |
Output is correct |
3 |
Correct |
33 ms |
338908 KB |
Output is correct |
4 |
Correct |
53 ms |
367700 KB |
Output is correct |
5 |
Correct |
70 ms |
367956 KB |
Output is correct |
6 |
Correct |
91 ms |
371032 KB |
Output is correct |
7 |
Correct |
94 ms |
371088 KB |
Output is correct |
8 |
Correct |
88 ms |
371020 KB |
Output is correct |
9 |
Correct |
90 ms |
371024 KB |
Output is correct |
10 |
Correct |
90 ms |
371108 KB |
Output is correct |
11 |
Correct |
89 ms |
371028 KB |
Output is correct |
12 |
Correct |
92 ms |
370912 KB |
Output is correct |
13 |
Correct |
89 ms |
370868 KB |
Output is correct |
14 |
Correct |
90 ms |
370948 KB |
Output is correct |
15 |
Correct |
89 ms |
371056 KB |
Output is correct |
16 |
Correct |
31 ms |
322640 KB |
Output is correct |
17 |
Correct |
31 ms |
326748 KB |
Output is correct |
18 |
Correct |
34 ms |
339028 KB |
Output is correct |
19 |
Correct |
53 ms |
367952 KB |
Output is correct |
20 |
Correct |
71 ms |
368148 KB |
Output is correct |
21 |
Correct |
90 ms |
371024 KB |
Output is correct |
22 |
Correct |
95 ms |
371028 KB |
Output is correct |
23 |
Correct |
89 ms |
370768 KB |
Output is correct |
24 |
Correct |
91 ms |
370768 KB |
Output is correct |
25 |
Correct |
89 ms |
370768 KB |
Output is correct |
26 |
Correct |
93 ms |
371112 KB |
Output is correct |
27 |
Correct |
91 ms |
370772 KB |
Output is correct |
28 |
Correct |
90 ms |
371096 KB |
Output is correct |
29 |
Correct |
93 ms |
371132 KB |
Output is correct |
30 |
Correct |
89 ms |
370756 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
31 ms |
322648 KB |
Output is correct |
2 |
Correct |
31 ms |
326460 KB |
Output is correct |
3 |
Correct |
33 ms |
338908 KB |
Output is correct |
4 |
Correct |
53 ms |
367700 KB |
Output is correct |
5 |
Correct |
70 ms |
367956 KB |
Output is correct |
6 |
Correct |
91 ms |
371032 KB |
Output is correct |
7 |
Correct |
94 ms |
371088 KB |
Output is correct |
8 |
Correct |
88 ms |
371020 KB |
Output is correct |
9 |
Correct |
90 ms |
371024 KB |
Output is correct |
10 |
Correct |
90 ms |
371108 KB |
Output is correct |
11 |
Correct |
89 ms |
371028 KB |
Output is correct |
12 |
Correct |
92 ms |
370912 KB |
Output is correct |
13 |
Correct |
89 ms |
370868 KB |
Output is correct |
14 |
Correct |
90 ms |
370948 KB |
Output is correct |
15 |
Correct |
89 ms |
371056 KB |
Output is correct |
16 |
Correct |
31 ms |
322640 KB |
Output is correct |
17 |
Correct |
31 ms |
326748 KB |
Output is correct |
18 |
Correct |
34 ms |
339028 KB |
Output is correct |
19 |
Correct |
53 ms |
367952 KB |
Output is correct |
20 |
Correct |
71 ms |
368148 KB |
Output is correct |
21 |
Correct |
90 ms |
371024 KB |
Output is correct |
22 |
Correct |
95 ms |
371028 KB |
Output is correct |
23 |
Correct |
89 ms |
370768 KB |
Output is correct |
24 |
Correct |
91 ms |
370768 KB |
Output is correct |
25 |
Correct |
89 ms |
370768 KB |
Output is correct |
26 |
Correct |
93 ms |
371112 KB |
Output is correct |
27 |
Correct |
91 ms |
370772 KB |
Output is correct |
28 |
Correct |
90 ms |
371096 KB |
Output is correct |
29 |
Correct |
93 ms |
371132 KB |
Output is correct |
30 |
Correct |
89 ms |
370756 KB |
Output is correct |
31 |
Correct |
31 ms |
326740 KB |
Output is correct |
32 |
Correct |
30 ms |
326480 KB |
Output is correct |
33 |
Correct |
30 ms |
326468 KB |
Output is correct |
34 |
Correct |
33 ms |
339028 KB |
Output is correct |
35 |
Correct |
34 ms |
339028 KB |
Output is correct |
36 |
Correct |
33 ms |
338960 KB |
Output is correct |
37 |
Correct |
44 ms |
367896 KB |
Output is correct |
38 |
Correct |
43 ms |
367696 KB |
Output is correct |
39 |
Correct |
54 ms |
368128 KB |
Output is correct |
40 |
Correct |
73 ms |
368412 KB |
Output is correct |
41 |
Correct |
92 ms |
371360 KB |
Output is correct |
42 |
Correct |
91 ms |
371296 KB |
Output is correct |
43 |
Correct |
93 ms |
371380 KB |
Output is correct |
44 |
Correct |
91 ms |
371284 KB |
Output is correct |
45 |
Correct |
92 ms |
371280 KB |
Output is correct |
46 |
Correct |
91 ms |
371260 KB |
Output is correct |
47 |
Correct |
93 ms |
371312 KB |
Output is correct |
48 |
Correct |
91 ms |
371352 KB |
Output is correct |
49 |
Correct |
91 ms |
371216 KB |
Output is correct |
50 |
Correct |
91 ms |
371280 KB |
Output is correct |
51 |
Correct |
95 ms |
371296 KB |
Output is correct |
52 |
Correct |
94 ms |
371284 KB |
Output is correct |
53 |
Correct |
90 ms |
371228 KB |
Output is correct |
54 |
Correct |
91 ms |
371280 KB |
Output is correct |
55 |
Correct |
91 ms |
371164 KB |
Output is correct |
56 |
Correct |
93 ms |
371284 KB |
Output is correct |
57 |
Correct |
91 ms |
371280 KB |
Output is correct |
58 |
Correct |
90 ms |
371172 KB |
Output is correct |
59 |
Correct |
96 ms |
371416 KB |
Output is correct |
60 |
Correct |
93 ms |
371372 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
31 ms |
322388 KB |
Output is correct |
2 |
Correct |
32 ms |
322384 KB |
Output is correct |
3 |
Correct |
31 ms |
322388 KB |
Output is correct |
4 |
Correct |
31 ms |
322672 KB |
Output is correct |
5 |
Correct |
30 ms |
322388 KB |
Output is correct |
6 |
Correct |
30 ms |
322388 KB |
Output is correct |
7 |
Correct |
30 ms |
322604 KB |
Output is correct |
8 |
Correct |
30 ms |
322388 KB |
Output is correct |
9 |
Correct |
30 ms |
322388 KB |
Output is correct |
10 |
Correct |
30 ms |
322384 KB |
Output is correct |
11 |
Correct |
31 ms |
322648 KB |
Output is correct |
12 |
Correct |
31 ms |
326460 KB |
Output is correct |
13 |
Correct |
33 ms |
338908 KB |
Output is correct |
14 |
Correct |
53 ms |
367700 KB |
Output is correct |
15 |
Correct |
70 ms |
367956 KB |
Output is correct |
16 |
Correct |
91 ms |
371032 KB |
Output is correct |
17 |
Correct |
94 ms |
371088 KB |
Output is correct |
18 |
Correct |
88 ms |
371020 KB |
Output is correct |
19 |
Correct |
90 ms |
371024 KB |
Output is correct |
20 |
Correct |
90 ms |
371108 KB |
Output is correct |
21 |
Correct |
89 ms |
371028 KB |
Output is correct |
22 |
Correct |
92 ms |
370912 KB |
Output is correct |
23 |
Correct |
89 ms |
370868 KB |
Output is correct |
24 |
Correct |
90 ms |
370948 KB |
Output is correct |
25 |
Correct |
89 ms |
371056 KB |
Output is correct |
26 |
Correct |
31 ms |
322640 KB |
Output is correct |
27 |
Correct |
31 ms |
326748 KB |
Output is correct |
28 |
Correct |
34 ms |
339028 KB |
Output is correct |
29 |
Correct |
53 ms |
367952 KB |
Output is correct |
30 |
Correct |
71 ms |
368148 KB |
Output is correct |
31 |
Correct |
90 ms |
371024 KB |
Output is correct |
32 |
Correct |
95 ms |
371028 KB |
Output is correct |
33 |
Correct |
89 ms |
370768 KB |
Output is correct |
34 |
Correct |
91 ms |
370768 KB |
Output is correct |
35 |
Correct |
89 ms |
370768 KB |
Output is correct |
36 |
Correct |
93 ms |
371112 KB |
Output is correct |
37 |
Correct |
91 ms |
370772 KB |
Output is correct |
38 |
Correct |
90 ms |
371096 KB |
Output is correct |
39 |
Correct |
93 ms |
371132 KB |
Output is correct |
40 |
Correct |
89 ms |
370756 KB |
Output is correct |
41 |
Correct |
31 ms |
326740 KB |
Output is correct |
42 |
Correct |
30 ms |
326480 KB |
Output is correct |
43 |
Correct |
30 ms |
326468 KB |
Output is correct |
44 |
Correct |
33 ms |
339028 KB |
Output is correct |
45 |
Correct |
34 ms |
339028 KB |
Output is correct |
46 |
Correct |
33 ms |
338960 KB |
Output is correct |
47 |
Correct |
44 ms |
367896 KB |
Output is correct |
48 |
Correct |
43 ms |
367696 KB |
Output is correct |
49 |
Correct |
54 ms |
368128 KB |
Output is correct |
50 |
Correct |
73 ms |
368412 KB |
Output is correct |
51 |
Correct |
92 ms |
371360 KB |
Output is correct |
52 |
Correct |
91 ms |
371296 KB |
Output is correct |
53 |
Correct |
93 ms |
371380 KB |
Output is correct |
54 |
Correct |
91 ms |
371284 KB |
Output is correct |
55 |
Correct |
92 ms |
371280 KB |
Output is correct |
56 |
Correct |
91 ms |
371260 KB |
Output is correct |
57 |
Correct |
93 ms |
371312 KB |
Output is correct |
58 |
Correct |
91 ms |
371352 KB |
Output is correct |
59 |
Correct |
91 ms |
371216 KB |
Output is correct |
60 |
Correct |
91 ms |
371280 KB |
Output is correct |
61 |
Correct |
95 ms |
371296 KB |
Output is correct |
62 |
Correct |
94 ms |
371284 KB |
Output is correct |
63 |
Correct |
90 ms |
371228 KB |
Output is correct |
64 |
Correct |
91 ms |
371280 KB |
Output is correct |
65 |
Correct |
91 ms |
371164 KB |
Output is correct |
66 |
Correct |
93 ms |
371284 KB |
Output is correct |
67 |
Correct |
91 ms |
371280 KB |
Output is correct |
68 |
Correct |
90 ms |
371172 KB |
Output is correct |
69 |
Correct |
96 ms |
371416 KB |
Output is correct |
70 |
Correct |
93 ms |
371372 KB |
Output is correct |
71 |
Correct |
43 ms |
367952 KB |
Output is correct |
72 |
Correct |
44 ms |
367916 KB |
Output is correct |
73 |
Correct |
43 ms |
367952 KB |
Output is correct |
74 |
Correct |
43 ms |
367952 KB |
Output is correct |
75 |
Correct |
43 ms |
367956 KB |
Output is correct |
76 |
Correct |
54 ms |
368212 KB |
Output is correct |
77 |
Correct |
53 ms |
367972 KB |
Output is correct |
78 |
Correct |
53 ms |
368132 KB |
Output is correct |
79 |
Correct |
54 ms |
368208 KB |
Output is correct |
80 |
Correct |
54 ms |
368212 KB |
Output is correct |
81 |
Correct |
75 ms |
368424 KB |
Output is correct |
82 |
Correct |
71 ms |
368208 KB |
Output is correct |
83 |
Correct |
72 ms |
368256 KB |
Output is correct |
84 |
Correct |
75 ms |
368208 KB |
Output is correct |
85 |
Correct |
73 ms |
368704 KB |
Output is correct |
86 |
Correct |
73 ms |
368380 KB |
Output is correct |
87 |
Correct |
73 ms |
368396 KB |
Output is correct |
88 |
Correct |
73 ms |
368564 KB |
Output is correct |
89 |
Correct |
74 ms |
368364 KB |
Output is correct |
90 |
Correct |
76 ms |
368756 KB |
Output is correct |
91 |
Correct |
93 ms |
371660 KB |
Output is correct |
92 |
Correct |
93 ms |
371592 KB |
Output is correct |
93 |
Correct |
95 ms |
371560 KB |
Output is correct |
94 |
Correct |
96 ms |
371704 KB |
Output is correct |
95 |
Correct |
93 ms |
371484 KB |
Output is correct |
96 |
Correct |
95 ms |
371640 KB |
Output is correct |
97 |
Correct |
97 ms |
371540 KB |
Output is correct |
98 |
Correct |
96 ms |
371652 KB |
Output is correct |
99 |
Correct |
106 ms |
371556 KB |
Output is correct |
100 |
Correct |
97 ms |
371588 KB |
Output is correct |
101 |
Correct |
98 ms |
371832 KB |
Output is correct |
102 |
Correct |
97 ms |
371604 KB |
Output is correct |
103 |
Correct |
100 ms |
371524 KB |
Output is correct |
104 |
Correct |
96 ms |
371676 KB |
Output is correct |
105 |
Correct |
97 ms |
371540 KB |
Output is correct |
106 |
Correct |
99 ms |
371692 KB |
Output is correct |
107 |
Correct |
98 ms |
371980 KB |
Output is correct |
108 |
Correct |
95 ms |
371652 KB |
Output is correct |
109 |
Correct |
95 ms |
371536 KB |
Output is correct |
110 |
Correct |
95 ms |
371588 KB |
Output is correct |
111 |
Correct |
102 ms |
371544 KB |
Output is correct |
112 |
Correct |
95 ms |
371536 KB |
Output is correct |
113 |
Correct |
99 ms |
371656 KB |
Output is correct |
114 |
Correct |
95 ms |
371536 KB |
Output is correct |
115 |
Correct |
99 ms |
371644 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
31 ms |
322388 KB |
Output is correct |
2 |
Correct |
32 ms |
322384 KB |
Output is correct |
3 |
Correct |
31 ms |
322388 KB |
Output is correct |
4 |
Correct |
31 ms |
322672 KB |
Output is correct |
5 |
Correct |
30 ms |
322388 KB |
Output is correct |
6 |
Correct |
30 ms |
322388 KB |
Output is correct |
7 |
Correct |
30 ms |
322604 KB |
Output is correct |
8 |
Correct |
30 ms |
322388 KB |
Output is correct |
9 |
Correct |
30 ms |
322388 KB |
Output is correct |
10 |
Correct |
30 ms |
322384 KB |
Output is correct |
11 |
Correct |
31 ms |
322648 KB |
Output is correct |
12 |
Correct |
31 ms |
326460 KB |
Output is correct |
13 |
Correct |
33 ms |
338908 KB |
Output is correct |
14 |
Correct |
53 ms |
367700 KB |
Output is correct |
15 |
Correct |
70 ms |
367956 KB |
Output is correct |
16 |
Correct |
91 ms |
371032 KB |
Output is correct |
17 |
Correct |
94 ms |
371088 KB |
Output is correct |
18 |
Correct |
88 ms |
371020 KB |
Output is correct |
19 |
Correct |
90 ms |
371024 KB |
Output is correct |
20 |
Correct |
90 ms |
371108 KB |
Output is correct |
21 |
Correct |
89 ms |
371028 KB |
Output is correct |
22 |
Correct |
92 ms |
370912 KB |
Output is correct |
23 |
Correct |
89 ms |
370868 KB |
Output is correct |
24 |
Correct |
90 ms |
370948 KB |
Output is correct |
25 |
Correct |
89 ms |
371056 KB |
Output is correct |
26 |
Correct |
31 ms |
322640 KB |
Output is correct |
27 |
Correct |
31 ms |
326748 KB |
Output is correct |
28 |
Correct |
34 ms |
339028 KB |
Output is correct |
29 |
Correct |
53 ms |
367952 KB |
Output is correct |
30 |
Correct |
71 ms |
368148 KB |
Output is correct |
31 |
Correct |
90 ms |
371024 KB |
Output is correct |
32 |
Correct |
95 ms |
371028 KB |
Output is correct |
33 |
Correct |
89 ms |
370768 KB |
Output is correct |
34 |
Correct |
91 ms |
370768 KB |
Output is correct |
35 |
Correct |
89 ms |
370768 KB |
Output is correct |
36 |
Correct |
93 ms |
371112 KB |
Output is correct |
37 |
Correct |
91 ms |
370772 KB |
Output is correct |
38 |
Correct |
90 ms |
371096 KB |
Output is correct |
39 |
Correct |
93 ms |
371132 KB |
Output is correct |
40 |
Correct |
89 ms |
370756 KB |
Output is correct |
41 |
Correct |
31 ms |
326740 KB |
Output is correct |
42 |
Correct |
30 ms |
326480 KB |
Output is correct |
43 |
Correct |
30 ms |
326468 KB |
Output is correct |
44 |
Correct |
33 ms |
339028 KB |
Output is correct |
45 |
Correct |
34 ms |
339028 KB |
Output is correct |
46 |
Correct |
33 ms |
338960 KB |
Output is correct |
47 |
Correct |
44 ms |
367896 KB |
Output is correct |
48 |
Correct |
43 ms |
367696 KB |
Output is correct |
49 |
Correct |
54 ms |
368128 KB |
Output is correct |
50 |
Correct |
73 ms |
368412 KB |
Output is correct |
51 |
Correct |
92 ms |
371360 KB |
Output is correct |
52 |
Correct |
91 ms |
371296 KB |
Output is correct |
53 |
Correct |
93 ms |
371380 KB |
Output is correct |
54 |
Correct |
91 ms |
371284 KB |
Output is correct |
55 |
Correct |
92 ms |
371280 KB |
Output is correct |
56 |
Correct |
91 ms |
371260 KB |
Output is correct |
57 |
Correct |
93 ms |
371312 KB |
Output is correct |
58 |
Correct |
91 ms |
371352 KB |
Output is correct |
59 |
Correct |
91 ms |
371216 KB |
Output is correct |
60 |
Correct |
91 ms |
371280 KB |
Output is correct |
61 |
Correct |
95 ms |
371296 KB |
Output is correct |
62 |
Correct |
94 ms |
371284 KB |
Output is correct |
63 |
Correct |
90 ms |
371228 KB |
Output is correct |
64 |
Correct |
91 ms |
371280 KB |
Output is correct |
65 |
Correct |
91 ms |
371164 KB |
Output is correct |
66 |
Correct |
93 ms |
371284 KB |
Output is correct |
67 |
Correct |
91 ms |
371280 KB |
Output is correct |
68 |
Correct |
90 ms |
371172 KB |
Output is correct |
69 |
Correct |
96 ms |
371416 KB |
Output is correct |
70 |
Correct |
93 ms |
371372 KB |
Output is correct |
71 |
Correct |
43 ms |
367952 KB |
Output is correct |
72 |
Correct |
44 ms |
367916 KB |
Output is correct |
73 |
Correct |
43 ms |
367952 KB |
Output is correct |
74 |
Correct |
43 ms |
367952 KB |
Output is correct |
75 |
Correct |
43 ms |
367956 KB |
Output is correct |
76 |
Correct |
54 ms |
368212 KB |
Output is correct |
77 |
Correct |
53 ms |
367972 KB |
Output is correct |
78 |
Correct |
53 ms |
368132 KB |
Output is correct |
79 |
Correct |
54 ms |
368208 KB |
Output is correct |
80 |
Correct |
54 ms |
368212 KB |
Output is correct |
81 |
Correct |
75 ms |
368424 KB |
Output is correct |
82 |
Correct |
71 ms |
368208 KB |
Output is correct |
83 |
Correct |
72 ms |
368256 KB |
Output is correct |
84 |
Correct |
75 ms |
368208 KB |
Output is correct |
85 |
Correct |
73 ms |
368704 KB |
Output is correct |
86 |
Correct |
73 ms |
368380 KB |
Output is correct |
87 |
Correct |
73 ms |
368396 KB |
Output is correct |
88 |
Correct |
73 ms |
368564 KB |
Output is correct |
89 |
Correct |
74 ms |
368364 KB |
Output is correct |
90 |
Correct |
76 ms |
368756 KB |
Output is correct |
91 |
Correct |
93 ms |
371660 KB |
Output is correct |
92 |
Correct |
93 ms |
371592 KB |
Output is correct |
93 |
Correct |
95 ms |
371560 KB |
Output is correct |
94 |
Correct |
96 ms |
371704 KB |
Output is correct |
95 |
Correct |
93 ms |
371484 KB |
Output is correct |
96 |
Correct |
95 ms |
371640 KB |
Output is correct |
97 |
Correct |
97 ms |
371540 KB |
Output is correct |
98 |
Correct |
96 ms |
371652 KB |
Output is correct |
99 |
Correct |
106 ms |
371556 KB |
Output is correct |
100 |
Correct |
97 ms |
371588 KB |
Output is correct |
101 |
Correct |
98 ms |
371832 KB |
Output is correct |
102 |
Correct |
97 ms |
371604 KB |
Output is correct |
103 |
Correct |
100 ms |
371524 KB |
Output is correct |
104 |
Correct |
96 ms |
371676 KB |
Output is correct |
105 |
Correct |
97 ms |
371540 KB |
Output is correct |
106 |
Correct |
99 ms |
371692 KB |
Output is correct |
107 |
Correct |
98 ms |
371980 KB |
Output is correct |
108 |
Correct |
95 ms |
371652 KB |
Output is correct |
109 |
Correct |
95 ms |
371536 KB |
Output is correct |
110 |
Correct |
95 ms |
371588 KB |
Output is correct |
111 |
Correct |
102 ms |
371544 KB |
Output is correct |
112 |
Correct |
95 ms |
371536 KB |
Output is correct |
113 |
Correct |
99 ms |
371656 KB |
Output is correct |
114 |
Correct |
95 ms |
371536 KB |
Output is correct |
115 |
Correct |
99 ms |
371644 KB |
Output is correct |
116 |
Correct |
162 ms |
343884 KB |
Output is correct |
117 |
Correct |
155 ms |
343892 KB |
Output is correct |
118 |
Correct |
286 ms |
373044 KB |
Output is correct |
119 |
Correct |
389 ms |
372880 KB |
Output is correct |
120 |
Correct |
314 ms |
372860 KB |
Output is correct |
121 |
Correct |
520 ms |
373036 KB |
Output is correct |
122 |
Correct |
427 ms |
373016 KB |
Output is correct |
123 |
Correct |
832 ms |
373484 KB |
Output is correct |
124 |
Correct |
560 ms |
373772 KB |
Output is correct |
125 |
Correct |
418 ms |
373912 KB |
Output is correct |
126 |
Correct |
865 ms |
376936 KB |
Output is correct |
127 |
Correct |
843 ms |
377028 KB |
Output is correct |
128 |
Correct |
843 ms |
377168 KB |
Output is correct |
129 |
Correct |
830 ms |
377172 KB |
Output is correct |
130 |
Correct |
841 ms |
377168 KB |
Output is correct |
131 |
Correct |
996 ms |
377172 KB |
Output is correct |
132 |
Correct |
1014 ms |
376908 KB |
Output is correct |
133 |
Correct |
1000 ms |
377208 KB |
Output is correct |
134 |
Correct |
1010 ms |
377168 KB |
Output is correct |
135 |
Correct |
1012 ms |
376916 KB |
Output is correct |
136 |
Correct |
1033 ms |
376972 KB |
Output is correct |
137 |
Correct |
1010 ms |
377028 KB |
Output is correct |
138 |
Correct |
1014 ms |
377024 KB |
Output is correct |
139 |
Correct |
1000 ms |
376956 KB |
Output is correct |
140 |
Correct |
1020 ms |
377172 KB |
Output is correct |
141 |
Correct |
1158 ms |
377032 KB |
Output is correct |
142 |
Correct |
1144 ms |
377176 KB |
Output is correct |
143 |
Correct |
1165 ms |
377168 KB |
Output is correct |
144 |
Correct |
1165 ms |
377080 KB |
Output is correct |
145 |
Correct |
1149 ms |
377008 KB |
Output is correct |
146 |
Correct |
803 ms |
377284 KB |
Output is correct |
147 |
Correct |
799 ms |
377268 KB |
Output is correct |
148 |
Correct |
816 ms |
377284 KB |
Output is correct |
149 |
Correct |
811 ms |
377288 KB |
Output is correct |
150 |
Correct |
843 ms |
377396 KB |
Output is correct |
151 |
Correct |
660 ms |
377252 KB |
Output is correct |
152 |
Correct |
664 ms |
377320 KB |
Output is correct |
153 |
Correct |
689 ms |
377276 KB |
Output is correct |
154 |
Correct |
689 ms |
377260 KB |
Output is correct |
155 |
Correct |
679 ms |
377324 KB |
Output is correct |
156 |
Correct |
898 ms |
377944 KB |
Output is correct |
157 |
Correct |
912 ms |
377680 KB |
Output is correct |
158 |
Correct |
925 ms |
377576 KB |
Output is correct |
159 |
Correct |
903 ms |
377592 KB |
Output is correct |
160 |
Correct |
907 ms |
377532 KB |
Output is correct |
161 |
Correct |
539 ms |
377640 KB |
Output is correct |
162 |
Correct |
545 ms |
377688 KB |
Output is correct |
163 |
Correct |
522 ms |
377912 KB |
Output is correct |
164 |
Correct |
550 ms |
377640 KB |
Output is correct |
165 |
Correct |
526 ms |
377668 KB |
Output is correct |
166 |
Correct |
956 ms |
377652 KB |
Output is correct |
167 |
Correct |
948 ms |
377424 KB |
Output is correct |
168 |
Correct |
954 ms |
377484 KB |
Output is correct |
169 |
Correct |
952 ms |
377464 KB |
Output is correct |
170 |
Correct |
958 ms |
377680 KB |
Output is correct |
171 |
Correct |
1052 ms |
377528 KB |
Output is correct |
172 |
Correct |
871 ms |
377544 KB |
Output is correct |
173 |
Correct |
881 ms |
377680 KB |
Output is correct |
174 |
Correct |
890 ms |
377680 KB |
Output is correct |
175 |
Correct |
893 ms |
377692 KB |
Output is correct |