//#pragma GCC optimize("Ofast,unroll-loops")
#include <bits/stdc++.h>
using namespace std;
typedef long long llo;
#define mp make_pair
#define pb push_back
#define a first
#define b second
#define endl '\n'
//vector<llo> adj[200001];
llo it[300001];
llo dp[300001];//[30001];
llo dp2[300001];
llo pre[300001];
llo ans2[300001];
const llo cc=400;
bool cmp(pair<pair<llo,llo>,llo> aa,pair<pair<llo,llo>,llo> bb){
llo x=aa.a.a/cc;
llo y=bb.a.a/cc;
if(x<y){
return true;
}
else if(x>y){
return false;
}
return aa.a.b<bb.a.b;
}
llo freq[300001];
llo cnt[300001];
set<llo> xx;
void add(llo i){
cnt[freq[it[i]]]--;
if(cnt[freq[it[i]]]==0 and freq[it[i]]>0){
xx.erase(freq[it[i]]);
}
freq[it[i]]++;
cnt[freq[it[i]]]++;
if(cnt[freq[it[i]]]==1){
xx.insert(freq[it[i]]);
}
}
void remove(llo i){
cnt[freq[it[i]]]--;
if(cnt[freq[it[i]]]==0 and freq[it[i]]>0){
xx.erase(freq[it[i]]);
}
freq[it[i]]--;
cnt[freq[it[i]]]++;
if(cnt[freq[it[i]]]==1 and freq[it[i]]>0){
xx.insert(freq[it[i]]);
}
}
llo cal(llo su,llo j,llo yy){
//sum of squares of (su+j),(su+2*j),,,,(su+yy*j)
//ans+=cal(su,j,yy);
llo ac=0;
ac+=su*su*yy;
ac+=((j*j)*(((yy*(yy+1)*(2*yy+1))/6)));
ac+=(su*j*((yy*(yy+1))));
//cout<<su<<":"<<j<<":"<<yy<<":"<<ac<<endl;
return ac;
}
int main(){
ios_base::sync_with_stdio(false);
cin.tie(NULL);
llo n,q;
cin>>n>>q;
map<llo,llo> ss;
for(llo i=0;i<n;i++){
cin>>it[i];
ss[it[i]]++;
}
vector<llo> tt;
for(auto j:ss){
tt.pb(j.b);
}
sort(tt.begin(),tt.end());
for(llo i=1;i<=tt.size();i++){
pre[i]=pre[i-1]+tt[i-1];
}
llo m=tt.size();
llo ans=m*n*(n+1)-(m-1)*n;
/*vector<llo> ee;
for(llo i=0;i<tt.size();i+=2){
ee.pb(tt[i]);
}
for(llo i=tt.size()-1;i>=0;i--){
if(i%2==1){
ee.pb(tt[i]);
}
}*/
llo su=0;
//cout<<ans<<endl;
/*for(llo i=0;i+1<ee.size();i++){
su+=ee[i];
ans-=su*su;
ans-=(n-su)*(n-su);
}
*/
/* for(auto j:ee){
cout<<j<<",";
}
cout<<endl;*/
//cout<<ans<<endl;
/*if(m==1){
}
else{
for(llo i=0;i<tt.size();i++){
for(llo j=0;j<=n;j++){
dp[j]=-(llo)1e18;
}
if(i==0){
dp[tt[0]]=tt[0]*tt[0]+(n-tt[0])*(n-tt[0]);
}
else{
for(llo j=0;j<=n;j++){
llo cur=j+pre[tt.size()]-pre[i];
llo su=0;
su+=cur*cur;
su+=(n-cur)*(n-cur);
if(cur==n or cur==0){
su=0;
}
dp[j]=max(dp[j],dp2[j]+su);
if(j>=tt[i]){
llo cur=j;
llo su=0;
su+=cur*cur;
su+=(n-cur)*(n-cur);
if(cur==n or cur==0){
su=0;
}
dp[j]=max(dp[j],dp2[j-tt[i]]+su);
}
}
}
for(llo j=0;j<=n;j++){
dp2[j]=dp[j];
}
}
llo ma=0;
for(llo i=0;i<=n;i++){
ma=max(ma,dp[i]);
}
ans-=ma;
}*/
//ans/=2;
//divide ans/2
vector<pair<pair<llo,llo>,llo>> qq;
for(llo i=0;i<q;i++){
llo l,r;
cin>>l>>r;
l--;
r--;
qq.pb({{l,r},i});
//cout<<ans<<endl;
}
sort(qq.begin(),qq.end(),cmp);
llo l=0;
llo r=0;
add(l);
vector<llo> aa;
for(auto j:qq){
llo l2=j.a.a;
llo r2=j.a.b;
while(l>l2){
l--;
add(l);
}
while(r<r2){
r++;
add(r);
}
while(l<l2){
remove(l);
l++;
}
while(r>r2){
remove(r);
r--;
}
/* for(auto j:xx){
cout<<j<<",";
}
cout<<endl;*/
/*if(l2==r2){
ans2[j.b]=1;
continue;
}*/
//aa.clear();
llo mm=0;
for(auto j:xx){
//aa.pb(j);
mm+=cnt[j];
}
if(mm==1){
ans2[j.b]=((r2-l2+1)*(r2-l2+2))/2;
continue;
}
llo nn=r2-l2+1;
llo ans=mm*nn*(nn+1)-(mm-1)*nn;
//cout<<ans<<"::"<<endl;
llo cur=0;
llo su=0;
for(auto j:xx){
llo yy;
if(cur%2==0){
yy=(cnt[j]+1)/2;
}
else{
yy=cnt[j]/2;
}
if(yy>0){
//sum of squares of (su+j),(su+2*j),,,,(su+yy*j)
ans-=cal(su,j,yy);
ans-=cal(nn-(su+j*yy)-j,j,yy);
/*ans+=su*yy;
ans+=((j*j)*(((yy*(yy+1)*(2*yy+1))/6)));
ans+=(su*((yy*(yy+1))/2));*/
}
su+=yy*j;
cur+=cnt[j];
}
ans=(ans+(su*su)+((nn-su)*(nn-su)));
//cout<<su<<"::"<<endl;
//reverse(aa.begin(),aa.end());
su=0;
cur=1;
//cout<<cnt[1]<<"::"<<endl;
for(auto j:xx){
llo yy;
if(cur%2==0){
yy=(cnt[j]+1)/2;
}
else{
yy=cnt[j]/2;
}
if(yy>0){
//sum of squares of (su+j),(su+2*j),,,,(su+yy*j)
ans-=cal(su,j,yy);
ans-=cal(nn-(su+j*yy)-j,j,yy);
/*ans+=su*yy;
ans+=((j*j)*(((yy*(yy+1)*(2*yy+1))/6)));
ans+=(su*((yy*(yy+1))/2));*/
}
su+=yy*j;
cur+=cnt[j];
}
ans/=2;
ans2[j.b]=ans;
//cout<<ans<<endl;
//
}
for(llo i=0;i<q;i++){
cout<<ans2[i]<<endl;
}
return 0;
}
Compilation message
diversity.cpp: In function 'int main()':
diversity.cpp:80:15: warning: comparison of integer expressions of different signedness: 'llo' {aka 'long long int'} and 'std::vector<long long int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
80 | for(llo i=1;i<=tt.size();i++){
| ~^~~~~~~~~~~
diversity.cpp:84:6: warning: unused variable 'ans' [-Wunused-variable]
84 | llo ans=m*n*(n+1)-(m-1)*n;
| ^~~
diversity.cpp:95:6: warning: unused variable 'su' [-Wunused-variable]
95 | llo su=0;
| ^~
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
332 KB |
Output is correct |
2 |
Correct |
0 ms |
332 KB |
Output is correct |
3 |
Correct |
1 ms |
328 KB |
Output is correct |
4 |
Correct |
0 ms |
332 KB |
Output is correct |
5 |
Correct |
0 ms |
332 KB |
Output is correct |
6 |
Correct |
1 ms |
332 KB |
Output is correct |
7 |
Correct |
1 ms |
328 KB |
Output is correct |
8 |
Correct |
1 ms |
348 KB |
Output is correct |
9 |
Correct |
1 ms |
332 KB |
Output is correct |
10 |
Correct |
0 ms |
332 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
332 KB |
Output is correct |
2 |
Correct |
1 ms |
332 KB |
Output is correct |
3 |
Correct |
2 ms |
332 KB |
Output is correct |
4 |
Correct |
18 ms |
1284 KB |
Output is correct |
5 |
Correct |
48 ms |
2492 KB |
Output is correct |
6 |
Correct |
58 ms |
3092 KB |
Output is correct |
7 |
Correct |
43 ms |
3828 KB |
Output is correct |
8 |
Correct |
60 ms |
3072 KB |
Output is correct |
9 |
Correct |
53 ms |
3060 KB |
Output is correct |
10 |
Correct |
55 ms |
3388 KB |
Output is correct |
11 |
Correct |
57 ms |
3164 KB |
Output is correct |
12 |
Correct |
59 ms |
3068 KB |
Output is correct |
13 |
Correct |
57 ms |
3064 KB |
Output is correct |
14 |
Correct |
50 ms |
3184 KB |
Output is correct |
15 |
Correct |
67 ms |
3220 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
332 KB |
Output is correct |
2 |
Correct |
1 ms |
332 KB |
Output is correct |
3 |
Correct |
2 ms |
332 KB |
Output is correct |
4 |
Correct |
18 ms |
1284 KB |
Output is correct |
5 |
Correct |
48 ms |
2492 KB |
Output is correct |
6 |
Correct |
58 ms |
3092 KB |
Output is correct |
7 |
Correct |
43 ms |
3828 KB |
Output is correct |
8 |
Correct |
60 ms |
3072 KB |
Output is correct |
9 |
Correct |
53 ms |
3060 KB |
Output is correct |
10 |
Correct |
55 ms |
3388 KB |
Output is correct |
11 |
Correct |
57 ms |
3164 KB |
Output is correct |
12 |
Correct |
59 ms |
3068 KB |
Output is correct |
13 |
Correct |
57 ms |
3064 KB |
Output is correct |
14 |
Correct |
50 ms |
3184 KB |
Output is correct |
15 |
Correct |
67 ms |
3220 KB |
Output is correct |
16 |
Correct |
1 ms |
332 KB |
Output is correct |
17 |
Correct |
1 ms |
332 KB |
Output is correct |
18 |
Correct |
3 ms |
352 KB |
Output is correct |
19 |
Correct |
19 ms |
1240 KB |
Output is correct |
20 |
Correct |
57 ms |
2076 KB |
Output is correct |
21 |
Correct |
59 ms |
3080 KB |
Output is correct |
22 |
Correct |
82 ms |
2952 KB |
Output is correct |
23 |
Correct |
73 ms |
3032 KB |
Output is correct |
24 |
Correct |
62 ms |
2884 KB |
Output is correct |
25 |
Correct |
66 ms |
3012 KB |
Output is correct |
26 |
Correct |
84 ms |
2956 KB |
Output is correct |
27 |
Correct |
80 ms |
2984 KB |
Output is correct |
28 |
Correct |
57 ms |
3220 KB |
Output is correct |
29 |
Correct |
61 ms |
2944 KB |
Output is correct |
30 |
Correct |
88 ms |
2948 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
332 KB |
Output is correct |
2 |
Correct |
1 ms |
332 KB |
Output is correct |
3 |
Correct |
2 ms |
332 KB |
Output is correct |
4 |
Correct |
18 ms |
1284 KB |
Output is correct |
5 |
Correct |
48 ms |
2492 KB |
Output is correct |
6 |
Correct |
58 ms |
3092 KB |
Output is correct |
7 |
Correct |
43 ms |
3828 KB |
Output is correct |
8 |
Correct |
60 ms |
3072 KB |
Output is correct |
9 |
Correct |
53 ms |
3060 KB |
Output is correct |
10 |
Correct |
55 ms |
3388 KB |
Output is correct |
11 |
Correct |
57 ms |
3164 KB |
Output is correct |
12 |
Correct |
59 ms |
3068 KB |
Output is correct |
13 |
Correct |
57 ms |
3064 KB |
Output is correct |
14 |
Correct |
50 ms |
3184 KB |
Output is correct |
15 |
Correct |
67 ms |
3220 KB |
Output is correct |
16 |
Correct |
1 ms |
332 KB |
Output is correct |
17 |
Correct |
1 ms |
332 KB |
Output is correct |
18 |
Correct |
3 ms |
352 KB |
Output is correct |
19 |
Correct |
19 ms |
1240 KB |
Output is correct |
20 |
Correct |
57 ms |
2076 KB |
Output is correct |
21 |
Correct |
59 ms |
3080 KB |
Output is correct |
22 |
Correct |
82 ms |
2952 KB |
Output is correct |
23 |
Correct |
73 ms |
3032 KB |
Output is correct |
24 |
Correct |
62 ms |
2884 KB |
Output is correct |
25 |
Correct |
66 ms |
3012 KB |
Output is correct |
26 |
Correct |
84 ms |
2956 KB |
Output is correct |
27 |
Correct |
80 ms |
2984 KB |
Output is correct |
28 |
Correct |
57 ms |
3220 KB |
Output is correct |
29 |
Correct |
61 ms |
2944 KB |
Output is correct |
30 |
Correct |
88 ms |
2948 KB |
Output is correct |
31 |
Correct |
2 ms |
332 KB |
Output is correct |
32 |
Correct |
1 ms |
332 KB |
Output is correct |
33 |
Correct |
1 ms |
332 KB |
Output is correct |
34 |
Correct |
3 ms |
332 KB |
Output is correct |
35 |
Correct |
2 ms |
332 KB |
Output is correct |
36 |
Correct |
2 ms |
460 KB |
Output is correct |
37 |
Correct |
13 ms |
800 KB |
Output is correct |
38 |
Correct |
12 ms |
844 KB |
Output is correct |
39 |
Correct |
24 ms |
1172 KB |
Output is correct |
40 |
Correct |
39 ms |
1992 KB |
Output is correct |
41 |
Correct |
67 ms |
2716 KB |
Output is correct |
42 |
Correct |
86 ms |
2724 KB |
Output is correct |
43 |
Correct |
72 ms |
2760 KB |
Output is correct |
44 |
Correct |
68 ms |
2760 KB |
Output is correct |
45 |
Correct |
65 ms |
2772 KB |
Output is correct |
46 |
Correct |
98 ms |
2756 KB |
Output is correct |
47 |
Correct |
77 ms |
2796 KB |
Output is correct |
48 |
Correct |
70 ms |
2868 KB |
Output is correct |
49 |
Correct |
69 ms |
2780 KB |
Output is correct |
50 |
Correct |
65 ms |
2792 KB |
Output is correct |
51 |
Correct |
62 ms |
2800 KB |
Output is correct |
52 |
Correct |
67 ms |
2784 KB |
Output is correct |
53 |
Correct |
63 ms |
2792 KB |
Output is correct |
54 |
Correct |
63 ms |
2784 KB |
Output is correct |
55 |
Correct |
86 ms |
2788 KB |
Output is correct |
56 |
Correct |
64 ms |
2804 KB |
Output is correct |
57 |
Correct |
64 ms |
2768 KB |
Output is correct |
58 |
Correct |
86 ms |
2744 KB |
Output is correct |
59 |
Correct |
78 ms |
2756 KB |
Output is correct |
60 |
Correct |
90 ms |
2736 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
332 KB |
Output is correct |
2 |
Correct |
0 ms |
332 KB |
Output is correct |
3 |
Correct |
1 ms |
328 KB |
Output is correct |
4 |
Correct |
0 ms |
332 KB |
Output is correct |
5 |
Correct |
0 ms |
332 KB |
Output is correct |
6 |
Correct |
1 ms |
332 KB |
Output is correct |
7 |
Correct |
1 ms |
328 KB |
Output is correct |
8 |
Correct |
1 ms |
348 KB |
Output is correct |
9 |
Correct |
1 ms |
332 KB |
Output is correct |
10 |
Correct |
0 ms |
332 KB |
Output is correct |
11 |
Correct |
1 ms |
332 KB |
Output is correct |
12 |
Correct |
1 ms |
332 KB |
Output is correct |
13 |
Correct |
2 ms |
332 KB |
Output is correct |
14 |
Correct |
18 ms |
1284 KB |
Output is correct |
15 |
Correct |
48 ms |
2492 KB |
Output is correct |
16 |
Correct |
58 ms |
3092 KB |
Output is correct |
17 |
Correct |
43 ms |
3828 KB |
Output is correct |
18 |
Correct |
60 ms |
3072 KB |
Output is correct |
19 |
Correct |
53 ms |
3060 KB |
Output is correct |
20 |
Correct |
55 ms |
3388 KB |
Output is correct |
21 |
Correct |
57 ms |
3164 KB |
Output is correct |
22 |
Correct |
59 ms |
3068 KB |
Output is correct |
23 |
Correct |
57 ms |
3064 KB |
Output is correct |
24 |
Correct |
50 ms |
3184 KB |
Output is correct |
25 |
Correct |
67 ms |
3220 KB |
Output is correct |
26 |
Correct |
1 ms |
332 KB |
Output is correct |
27 |
Correct |
1 ms |
332 KB |
Output is correct |
28 |
Correct |
3 ms |
352 KB |
Output is correct |
29 |
Correct |
19 ms |
1240 KB |
Output is correct |
30 |
Correct |
57 ms |
2076 KB |
Output is correct |
31 |
Correct |
59 ms |
3080 KB |
Output is correct |
32 |
Correct |
82 ms |
2952 KB |
Output is correct |
33 |
Correct |
73 ms |
3032 KB |
Output is correct |
34 |
Correct |
62 ms |
2884 KB |
Output is correct |
35 |
Correct |
66 ms |
3012 KB |
Output is correct |
36 |
Correct |
84 ms |
2956 KB |
Output is correct |
37 |
Correct |
80 ms |
2984 KB |
Output is correct |
38 |
Correct |
57 ms |
3220 KB |
Output is correct |
39 |
Correct |
61 ms |
2944 KB |
Output is correct |
40 |
Correct |
88 ms |
2948 KB |
Output is correct |
41 |
Correct |
2 ms |
332 KB |
Output is correct |
42 |
Correct |
1 ms |
332 KB |
Output is correct |
43 |
Correct |
1 ms |
332 KB |
Output is correct |
44 |
Correct |
3 ms |
332 KB |
Output is correct |
45 |
Correct |
2 ms |
332 KB |
Output is correct |
46 |
Correct |
2 ms |
460 KB |
Output is correct |
47 |
Correct |
13 ms |
800 KB |
Output is correct |
48 |
Correct |
12 ms |
844 KB |
Output is correct |
49 |
Correct |
24 ms |
1172 KB |
Output is correct |
50 |
Correct |
39 ms |
1992 KB |
Output is correct |
51 |
Correct |
67 ms |
2716 KB |
Output is correct |
52 |
Correct |
86 ms |
2724 KB |
Output is correct |
53 |
Correct |
72 ms |
2760 KB |
Output is correct |
54 |
Correct |
68 ms |
2760 KB |
Output is correct |
55 |
Correct |
65 ms |
2772 KB |
Output is correct |
56 |
Correct |
98 ms |
2756 KB |
Output is correct |
57 |
Correct |
77 ms |
2796 KB |
Output is correct |
58 |
Correct |
70 ms |
2868 KB |
Output is correct |
59 |
Correct |
69 ms |
2780 KB |
Output is correct |
60 |
Correct |
65 ms |
2792 KB |
Output is correct |
61 |
Correct |
62 ms |
2800 KB |
Output is correct |
62 |
Correct |
67 ms |
2784 KB |
Output is correct |
63 |
Correct |
63 ms |
2792 KB |
Output is correct |
64 |
Correct |
63 ms |
2784 KB |
Output is correct |
65 |
Correct |
86 ms |
2788 KB |
Output is correct |
66 |
Correct |
64 ms |
2804 KB |
Output is correct |
67 |
Correct |
64 ms |
2768 KB |
Output is correct |
68 |
Correct |
86 ms |
2744 KB |
Output is correct |
69 |
Correct |
78 ms |
2756 KB |
Output is correct |
70 |
Correct |
90 ms |
2736 KB |
Output is correct |
71 |
Correct |
10 ms |
852 KB |
Output is correct |
72 |
Correct |
13 ms |
844 KB |
Output is correct |
73 |
Correct |
9 ms |
844 KB |
Output is correct |
74 |
Correct |
13 ms |
860 KB |
Output is correct |
75 |
Correct |
11 ms |
916 KB |
Output is correct |
76 |
Correct |
26 ms |
1608 KB |
Output is correct |
77 |
Correct |
20 ms |
1560 KB |
Output is correct |
78 |
Correct |
20 ms |
1560 KB |
Output is correct |
79 |
Correct |
27 ms |
1628 KB |
Output is correct |
80 |
Correct |
27 ms |
1492 KB |
Output is correct |
81 |
Correct |
52 ms |
2860 KB |
Output is correct |
82 |
Correct |
48 ms |
2796 KB |
Output is correct |
83 |
Correct |
49 ms |
2880 KB |
Output is correct |
84 |
Correct |
60 ms |
2844 KB |
Output is correct |
85 |
Correct |
60 ms |
2784 KB |
Output is correct |
86 |
Correct |
61 ms |
3708 KB |
Output is correct |
87 |
Correct |
68 ms |
3748 KB |
Output is correct |
88 |
Correct |
59 ms |
3708 KB |
Output is correct |
89 |
Correct |
58 ms |
3736 KB |
Output is correct |
90 |
Correct |
57 ms |
3752 KB |
Output is correct |
91 |
Correct |
144 ms |
11356 KB |
Output is correct |
92 |
Correct |
135 ms |
11320 KB |
Output is correct |
93 |
Correct |
147 ms |
11376 KB |
Output is correct |
94 |
Correct |
147 ms |
11320 KB |
Output is correct |
95 |
Correct |
149 ms |
11364 KB |
Output is correct |
96 |
Correct |
235 ms |
20144 KB |
Output is correct |
97 |
Correct |
249 ms |
20024 KB |
Output is correct |
98 |
Correct |
255 ms |
19976 KB |
Output is correct |
99 |
Correct |
241 ms |
19964 KB |
Output is correct |
100 |
Correct |
221 ms |
19936 KB |
Output is correct |
101 |
Correct |
225 ms |
19924 KB |
Output is correct |
102 |
Correct |
250 ms |
19972 KB |
Output is correct |
103 |
Correct |
233 ms |
20048 KB |
Output is correct |
104 |
Correct |
267 ms |
19988 KB |
Output is correct |
105 |
Correct |
234 ms |
20024 KB |
Output is correct |
106 |
Correct |
288 ms |
24232 KB |
Output is correct |
107 |
Correct |
283 ms |
24276 KB |
Output is correct |
108 |
Correct |
280 ms |
24308 KB |
Output is correct |
109 |
Correct |
280 ms |
24312 KB |
Output is correct |
110 |
Correct |
281 ms |
24304 KB |
Output is correct |
111 |
Correct |
276 ms |
24336 KB |
Output is correct |
112 |
Correct |
261 ms |
24324 KB |
Output is correct |
113 |
Correct |
286 ms |
24264 KB |
Output is correct |
114 |
Correct |
266 ms |
24236 KB |
Output is correct |
115 |
Correct |
283 ms |
24372 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
332 KB |
Output is correct |
2 |
Correct |
0 ms |
332 KB |
Output is correct |
3 |
Correct |
1 ms |
328 KB |
Output is correct |
4 |
Correct |
0 ms |
332 KB |
Output is correct |
5 |
Correct |
0 ms |
332 KB |
Output is correct |
6 |
Correct |
1 ms |
332 KB |
Output is correct |
7 |
Correct |
1 ms |
328 KB |
Output is correct |
8 |
Correct |
1 ms |
348 KB |
Output is correct |
9 |
Correct |
1 ms |
332 KB |
Output is correct |
10 |
Correct |
0 ms |
332 KB |
Output is correct |
11 |
Correct |
1 ms |
332 KB |
Output is correct |
12 |
Correct |
1 ms |
332 KB |
Output is correct |
13 |
Correct |
2 ms |
332 KB |
Output is correct |
14 |
Correct |
18 ms |
1284 KB |
Output is correct |
15 |
Correct |
48 ms |
2492 KB |
Output is correct |
16 |
Correct |
58 ms |
3092 KB |
Output is correct |
17 |
Correct |
43 ms |
3828 KB |
Output is correct |
18 |
Correct |
60 ms |
3072 KB |
Output is correct |
19 |
Correct |
53 ms |
3060 KB |
Output is correct |
20 |
Correct |
55 ms |
3388 KB |
Output is correct |
21 |
Correct |
57 ms |
3164 KB |
Output is correct |
22 |
Correct |
59 ms |
3068 KB |
Output is correct |
23 |
Correct |
57 ms |
3064 KB |
Output is correct |
24 |
Correct |
50 ms |
3184 KB |
Output is correct |
25 |
Correct |
67 ms |
3220 KB |
Output is correct |
26 |
Correct |
1 ms |
332 KB |
Output is correct |
27 |
Correct |
1 ms |
332 KB |
Output is correct |
28 |
Correct |
3 ms |
352 KB |
Output is correct |
29 |
Correct |
19 ms |
1240 KB |
Output is correct |
30 |
Correct |
57 ms |
2076 KB |
Output is correct |
31 |
Correct |
59 ms |
3080 KB |
Output is correct |
32 |
Correct |
82 ms |
2952 KB |
Output is correct |
33 |
Correct |
73 ms |
3032 KB |
Output is correct |
34 |
Correct |
62 ms |
2884 KB |
Output is correct |
35 |
Correct |
66 ms |
3012 KB |
Output is correct |
36 |
Correct |
84 ms |
2956 KB |
Output is correct |
37 |
Correct |
80 ms |
2984 KB |
Output is correct |
38 |
Correct |
57 ms |
3220 KB |
Output is correct |
39 |
Correct |
61 ms |
2944 KB |
Output is correct |
40 |
Correct |
88 ms |
2948 KB |
Output is correct |
41 |
Correct |
2 ms |
332 KB |
Output is correct |
42 |
Correct |
1 ms |
332 KB |
Output is correct |
43 |
Correct |
1 ms |
332 KB |
Output is correct |
44 |
Correct |
3 ms |
332 KB |
Output is correct |
45 |
Correct |
2 ms |
332 KB |
Output is correct |
46 |
Correct |
2 ms |
460 KB |
Output is correct |
47 |
Correct |
13 ms |
800 KB |
Output is correct |
48 |
Correct |
12 ms |
844 KB |
Output is correct |
49 |
Correct |
24 ms |
1172 KB |
Output is correct |
50 |
Correct |
39 ms |
1992 KB |
Output is correct |
51 |
Correct |
67 ms |
2716 KB |
Output is correct |
52 |
Correct |
86 ms |
2724 KB |
Output is correct |
53 |
Correct |
72 ms |
2760 KB |
Output is correct |
54 |
Correct |
68 ms |
2760 KB |
Output is correct |
55 |
Correct |
65 ms |
2772 KB |
Output is correct |
56 |
Correct |
98 ms |
2756 KB |
Output is correct |
57 |
Correct |
77 ms |
2796 KB |
Output is correct |
58 |
Correct |
70 ms |
2868 KB |
Output is correct |
59 |
Correct |
69 ms |
2780 KB |
Output is correct |
60 |
Correct |
65 ms |
2792 KB |
Output is correct |
61 |
Correct |
62 ms |
2800 KB |
Output is correct |
62 |
Correct |
67 ms |
2784 KB |
Output is correct |
63 |
Correct |
63 ms |
2792 KB |
Output is correct |
64 |
Correct |
63 ms |
2784 KB |
Output is correct |
65 |
Correct |
86 ms |
2788 KB |
Output is correct |
66 |
Correct |
64 ms |
2804 KB |
Output is correct |
67 |
Correct |
64 ms |
2768 KB |
Output is correct |
68 |
Correct |
86 ms |
2744 KB |
Output is correct |
69 |
Correct |
78 ms |
2756 KB |
Output is correct |
70 |
Correct |
90 ms |
2736 KB |
Output is correct |
71 |
Correct |
10 ms |
852 KB |
Output is correct |
72 |
Correct |
13 ms |
844 KB |
Output is correct |
73 |
Correct |
9 ms |
844 KB |
Output is correct |
74 |
Correct |
13 ms |
860 KB |
Output is correct |
75 |
Correct |
11 ms |
916 KB |
Output is correct |
76 |
Correct |
26 ms |
1608 KB |
Output is correct |
77 |
Correct |
20 ms |
1560 KB |
Output is correct |
78 |
Correct |
20 ms |
1560 KB |
Output is correct |
79 |
Correct |
27 ms |
1628 KB |
Output is correct |
80 |
Correct |
27 ms |
1492 KB |
Output is correct |
81 |
Correct |
52 ms |
2860 KB |
Output is correct |
82 |
Correct |
48 ms |
2796 KB |
Output is correct |
83 |
Correct |
49 ms |
2880 KB |
Output is correct |
84 |
Correct |
60 ms |
2844 KB |
Output is correct |
85 |
Correct |
60 ms |
2784 KB |
Output is correct |
86 |
Correct |
61 ms |
3708 KB |
Output is correct |
87 |
Correct |
68 ms |
3748 KB |
Output is correct |
88 |
Correct |
59 ms |
3708 KB |
Output is correct |
89 |
Correct |
58 ms |
3736 KB |
Output is correct |
90 |
Correct |
57 ms |
3752 KB |
Output is correct |
91 |
Correct |
144 ms |
11356 KB |
Output is correct |
92 |
Correct |
135 ms |
11320 KB |
Output is correct |
93 |
Correct |
147 ms |
11376 KB |
Output is correct |
94 |
Correct |
147 ms |
11320 KB |
Output is correct |
95 |
Correct |
149 ms |
11364 KB |
Output is correct |
96 |
Correct |
235 ms |
20144 KB |
Output is correct |
97 |
Correct |
249 ms |
20024 KB |
Output is correct |
98 |
Correct |
255 ms |
19976 KB |
Output is correct |
99 |
Correct |
241 ms |
19964 KB |
Output is correct |
100 |
Correct |
221 ms |
19936 KB |
Output is correct |
101 |
Correct |
225 ms |
19924 KB |
Output is correct |
102 |
Correct |
250 ms |
19972 KB |
Output is correct |
103 |
Correct |
233 ms |
20048 KB |
Output is correct |
104 |
Correct |
267 ms |
19988 KB |
Output is correct |
105 |
Correct |
234 ms |
20024 KB |
Output is correct |
106 |
Correct |
288 ms |
24232 KB |
Output is correct |
107 |
Correct |
283 ms |
24276 KB |
Output is correct |
108 |
Correct |
280 ms |
24308 KB |
Output is correct |
109 |
Correct |
280 ms |
24312 KB |
Output is correct |
110 |
Correct |
281 ms |
24304 KB |
Output is correct |
111 |
Correct |
276 ms |
24336 KB |
Output is correct |
112 |
Correct |
261 ms |
24324 KB |
Output is correct |
113 |
Correct |
286 ms |
24264 KB |
Output is correct |
114 |
Correct |
266 ms |
24236 KB |
Output is correct |
115 |
Correct |
283 ms |
24372 KB |
Output is correct |
116 |
Correct |
831 ms |
2512 KB |
Output is correct |
117 |
Correct |
664 ms |
2508 KB |
Output is correct |
118 |
Correct |
1792 ms |
2960 KB |
Output is correct |
119 |
Correct |
805 ms |
2992 KB |
Output is correct |
120 |
Correct |
452 ms |
3048 KB |
Output is correct |
121 |
Correct |
1366 ms |
3432 KB |
Output is correct |
122 |
Correct |
799 ms |
3624 KB |
Output is correct |
123 |
Correct |
5798 ms |
4340 KB |
Output is correct |
124 |
Correct |
1768 ms |
4708 KB |
Output is correct |
125 |
Correct |
1422 ms |
5140 KB |
Output is correct |
126 |
Execution timed out |
7044 ms |
4580 KB |
Time limit exceeded |
127 |
Halted |
0 ms |
0 KB |
- |