QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#110521 | #6540. Beautiful Sequence | Crysfly | AC ✓ | 317ms | 14956kb | C++17 | 2.1kb | 2023-06-02 18:18:38 | 2023-06-02 18:18:48 |
Judging History
answer
#include<bits/stdc++.h>
#define For(i,a,b) for(int i=(a);i<=(b);++i)
#define Rep(i,a,b) for(int i=(a);i>=(b);--i)
using namespace std;
inline int read()
{
char c=getchar();int x=0;bool f=0;
for(;!isdigit(c);c=getchar())f^=!(c^45);
for(;isdigit(c);c=getchar())x=(x<<1)+(x<<3)+(c^48);
if(f)x=-x;return x;
}
#define fi first
#define se second
#define pb push_back
#define mkp make_pair
typedef pair<int,int>pii;
typedef vector<int>vi;
#define maxn 300005
#define inf 0x3f3f3f3f
int n,m;
int t[maxn],a[maxn],p[maxn];
bool all[maxn];
int buc[maxn],lim[maxn];
//bool OK(){
// For(i,1,m)if(buc[i]>lim[i])return 0;
// return 1;
//}
// sum[i...n]<=lim[i]
// sum[i...n]<=-1
namespace T{
int t[maxn<<2],tag[maxn<<2];
void up(int p){
t[p]=max(t[p<<1],t[p<<1|1]);
}
void pt(int p,int v){
tag[p]+=v;
t[p]+=v;
}
void dw(int p){
pt(p<<1,tag[p]);
pt(p<<1|1,tag[p]);
tag[p]=0;
}
void build(int p,int l,int r){
tag[p]=0;
if(l==r)return t[p]=-(m-l+1),void();
int mid=l+r>>1;
build(p<<1,l,mid),build(p<<1|1,mid+1,r),up(p);
}
void add(int p,int l,int r,int ql,int qr,int v){
if(ql>qr)return;
if(l>=ql&&r<=qr)return pt(p,v);
int mid=l+r>>1; dw(p);
if(ql<=mid)add(p<<1,l,mid,ql,qr,v); if(qr>mid)add(p<<1|1,mid+1,r,ql,qr,v); up(p);
}
int ok(){
return t[1]<=-1;
}
}
void work()
{
n=read();m=0;
For(i,1,n)a[i]=read();
sort(a+1,a+n+1);
for(int l=1,r;l<=n;l=r+1){
r=l; while(r<n&&a[r+1]==a[l])++r;
t[++m]=r-l+1;
}
For(i,1,m)p[i]=i;
sort(p+1,p+m+1,[&](int x,int y){
return t[x]<t[y] || (t[x]==t[y]&&x<y);
});
// buc[m+1]=0; Rep(i,m,1)buc[i]=buc[i+1]-1,lim[i]=-1;
T::build(1,1,m);
int res=0;
For(i,1,m){
int x=p[i];
// int add=t[x]+1;
T::add(1,1,m,1,x,t[x]+1);
// For(j,1,x)buc[j]+=add;
if(!T::ok()){
T::add(1,1,m,1,x,-(t[x]+1));
// For(j,1,x)buc[j]-=add;
}
else{
// cout<<"add "<<x<<endl;
++res;
}
}
int all=1;
For(i,1,m)all+=t[i]-1;
// cout<<"res: "<<res<<"\n";
cout<<all+res<<"\n";
}
signed main()
{
int T=read();
while(T--)work();
return 0;
}
这程序好像有点Bug,我给组数据试试?
詳細信息
Test #1:
score: 100
Accepted
time: 3ms
memory: 5420kb
input:
2 6 1 1 2 3 3 4 5 1 2 2 3 3
output:
4 4
result:
ok 2 number(s): "4 4"
Test #2:
score: 0
Accepted
time: 2ms
memory: 5532kb
input:
2 5 1 2 2 3 3 20 1 1 1 1 1 1 4 5 8 8 8 8 9 9 9 9 10 10 10 10
output:
4 17
result:
ok 2 number(s): "4 17"
Test #3:
score: 0
Accepted
time: 2ms
memory: 5480kb
input:
300 14 1 1 1 2 2 2 3 3 3 4 5 5 6 6 14 1 1 1 2 2 3 3 4 4 5 5 6 7 7 14 1 1 2 2 3 4 4 4 5 5 5 6 6 6 14 1 1 2 2 3 3 3 4 5 5 5 6 6 6 14 1 1 1 1 1 1 2 2 2 2 2 3 3 3 14 1 1 1 1 1 1 1 1 1 1 1 1 1 1 14 1 2 2 3 4 5 5 6 6 6 7 8 8 8 14 1 2 2 2 2 2 3 4 5 6 7 8 9 10 14 1 2 2 3 4 4 4 5 6 6 6 6 6 7 14 1 1 2 2 2 3 3...
output:
10 9 11 11 12 14 10 9 11 11 9 10 10 9 11 11 11 9 9 12 10 9 10 10 11 10 11 11 11 11 10 8 10 10 10 10 11 13 10 12 11 11 9 10 9 11 11 10 10 8 11 10 11 9 10 10 10 10 11 11 12 9 10 10 10 10 9 10 11 11 10 10 10 10 11 10 10 10 10 9 9 10 8 11 9 11 10 11 11 12 9 9 10 9 12 11 10 11 10 10 11 10 10 9 10 9 10 10...
result:
ok 300 numbers
Test #4:
score: 0
Accepted
time: 0ms
memory: 5360kb
input:
300 13 1 1 1 2 3 3 4 4 5 5 6 6 7 13 1 1 2 3 3 3 4 5 5 6 7 8 8 13 1 2 3 4 4 4 5 5 6 7 8 8 9 13 1 2 3 4 5 6 7 8 8 8 9 10 10 13 1 1 1 1 2 3 4 5 5 6 6 7 8 13 1 1 1 2 3 4 5 5 6 6 7 7 7 13 1 2 2 3 3 4 5 5 5 5 5 6 7 13 1 2 3 3 3 4 4 5 6 6 7 8 9 13 1 2 3 3 3 3 3 4 4 5 6 7 7 13 1 2 3 4 5 6 6 6 7 7 7 8 9 13 1...
output:
9 9 9 8 9 9 9 9 10 9 9 8 8 10 9 10 9 9 10 11 9 9 10 9 9 10 10 10 10 9 8 9 9 8 9 10 10 8 10 9 11 9 10 9 9 10 12 12 9 9 9 9 9 10 10 10 9 9 9 8 9 9 9 8 9 10 9 9 8 10 10 9 10 8 9 9 10 9 9 9 9 8 9 9 10 8 10 9 9 10 10 11 8 9 9 11 11 9 10 10 9 11 11 10 9 10 9 9 8 10 9 10 10 9 9 10 9 9 9 10 8 9 10 10 9 10 1...
result:
ok 300 numbers
Test #5:
score: 0
Accepted
time: 3ms
memory: 5476kb
input:
310 14 1 2 2 2 3 4 5 6 6 6 7 8 8 9 14 1 1 1 1 1 2 2 3 3 3 3 3 3 4 14 1 2 2 3 3 3 3 3 3 3 4 4 4 5 14 1 2 2 2 3 4 5 5 5 6 7 8 8 9 14 1 2 2 3 4 5 5 6 7 8 8 9 10 11 14 1 2 2 3 3 3 3 4 5 6 6 7 8 9 14 1 1 2 2 3 3 4 4 4 4 5 6 7 8 14 1 2 3 4 4 5 6 6 7 8 9 9 9 9 14 1 1 2 2 2 3 3 3 3 3 4 5 6 6 14 1 2 3 3 3 4 ...
output:
10 11 11 10 9 9 9 10 11 9 9 8 8 11 9 9 10 8 10 11 11 9 12 9 11 12 11 8 11 11 10 9 8 11 10 10 9 8 12 10 11 10 9 10 10 11 11 11 10 11 9 10 11 11 10 9 9 9 9 9 10 10 9 8 10 9 10 11 9 10 10 10 10 11 9 10 10 9 10 11 11 9 10 11 11 11 11 9 10 9 10 10 9 10 10 9 11 10 10 8 9 12 9 10 10 11 10 10 11 10 9 10 10 ...
result:
ok 310 numbers
Test #6:
score: 0
Accepted
time: 3ms
memory: 7588kb
input:
1000 11 1 2 3 4 5 6 6 6 7 7 7 11 1 1 2 2 2 3 3 3 3 4 5 11 1 1 1 2 3 4 5 6 7 8 9 11 1 2 3 3 3 4 5 6 6 6 7 11 1 1 2 2 2 3 3 4 4 5 5 11 1 2 2 3 4 5 5 5 5 6 6 11 1 1 1 2 3 4 4 4 4 5 6 11 1 1 1 1 2 2 3 3 4 4 5 11 1 1 2 3 3 3 3 4 4 5 6 11 1 2 2 2 2 2 3 3 3 3 4 11 1 1 2 3 3 4 4 5 6 6 7 11 1 2 2 3 3 3 3 4 4...
output:
8 8 6 8 8 8 8 8 8 9 7 8 9 7 10 9 9 8 7 8 8 7 7 8 7 8 9 9 9 7 8 8 7 8 8 8 9 9 7 8 8 7 7 8 7 8 7 7 8 8 7 8 8 9 7 6 7 8 7 8 8 8 8 9 8 8 8 9 7 8 7 6 8 8 7 8 8 8 7 8 7 7 9 9 8 8 8 9 8 9 10 7 7 7 8 8 8 9 8 8 9 8 8 9 7 7 9 9 7 9 8 8 8 8 9 10 7 8 8 8 7 9 7 7 8 7 7 8 7 7 7 7 8 9 8 8 9 8 8 9 7 7 8 8 7 8 8 8 9...
result:
ok 1000 numbers
Test #7:
score: 0
Accepted
time: 2ms
memory: 5412kb
input:
100 15 1 2 3 4 5 6 7 7 7 8 9 10 10 10 10 15 1 2 2 2 2 2 3 3 3 4 5 6 7 8 9 15 1 1 1 1 1 2 2 2 3 4 4 4 4 5 6 15 1 1 1 2 2 2 3 3 4 5 5 5 5 6 7 15 1 1 1 2 2 3 4 4 4 4 4 4 4 5 6 15 1 1 1 1 2 3 4 5 5 6 7 7 7 7 7 15 1 2 2 3 3 3 3 3 4 5 5 5 6 7 8 15 1 2 3 4 4 4 5 6 7 8 8 9 9 9 10 15 1 1 2 2 2 2 3 4 4 4 4 4 ...
output:
10 10 11 11 11 11 11 10 12 11 12 11 10 10 11 10 11 11 12 12 11 12 11 11 11 12 10 12 13 10 10 11 11 11 10 12 11 11 12 12 11 11 10 12 11 11 11 10 10 11 11 11 10 10 11 11 10 9 11 11 11 11 11 10 11 11 11 11 11 11 10 11 10 10 10 11 12 11 10 10 11 11 12 11 11 12 11 11 10 11 11 11 11 12 10 10 10 10 10 11
result:
ok 100 numbers
Test #8:
score: 0
Accepted
time: 2ms
memory: 5576kb
input:
10 100 1000000000 999999999 999999999 999999998 999999998 999999998 999999997 999999997 999999997 999999997 999999996 999999996 999999995 999999995 999999995 999999995 999999994 999999994 999999994 999999994 999999994 999999994 999999994 999999993 999999993 999999993 999999993 999999993 999999993 99...
output:
87 87 87 87 88 88 87 87 88 87
result:
ok 10 numbers
Test #9:
score: 0
Accepted
time: 1ms
memory: 7604kb
input:
2 200 1000000000 999999999 999999998 999999997 999999996 999999996 999999996 999999996 999999996 999999995 999999994 999999994 999999994 999999994 999999994 999999993 999999993 999999993 999999993 999999992 999999992 999999992 999999992 999999992 999999992 999999991 999999991 999999991 999999991 999...
output:
182 182
result:
ok 2 number(s): "182 182"
Test #10:
score: 0
Accepted
time: 3ms
memory: 5380kb
input:
1 300 1 2 3 4 5 6 6 7 8 9 9 9 10 11 12 13 13 14 15 15 16 16 16 16 16 17 18 19 19 20 20 21 21 22 22 23 24 24 25 26 26 26 26 26 27 27 27 28 28 28 28 28 29 30 31 31 32 33 34 34 34 34 35 36 36 36 37 37 38 38 38 38 38 39 40 40 40 41 42 42 43 44 45 45 46 46 47 48 49 49 49 49 50 50 51 52 53 53 53 53 54 54 ...
output:
231
result:
ok 1 number(s): "231"
Test #11:
score: 0
Accepted
time: 1ms
memory: 5352kb
input:
10 1000 1000000000 999999999 999999999 999999998 999999997 999999997 999999997 999999996 999999996 999999996 999999995 999999995 999999995 999999994 999999994 999999993 999999993 999999993 999999993 999999992 999999992 999999992 999999992 999999992 999999992 999999991 999999991 999999991 999999991 9...
output:
957 956 957 957 957 957 956 957 956 957
result:
ok 10 numbers
Test #12:
score: 0
Accepted
time: 3ms
memory: 5372kb
input:
2 2000 1000000000 999999999 999999999 999999998 999999997 999999997 999999997 999999996 999999995 999999994 999999994 999999994 999999993 999999993 999999993 999999993 999999992 999999992 999999992 999999992 999999992 999999991 999999991 999999991 999999991 999999991 999999991 999999991 999999990 99...
output:
1938 1938
result:
ok 2 number(s): "1938 1938"
Test #13:
score: 0
Accepted
time: 1ms
memory: 5496kb
input:
1 1000 1 1 2 3 3 3 3 3 3 4 5 6 6 6 6 7 8 9 10 11 11 12 12 12 13 14 14 15 16 17 17 18 18 18 19 19 19 20 21 21 22 22 23 23 23 24 25 25 25 25 25 26 27 28 28 28 28 29 30 31 32 32 33 33 34 34 34 34 35 35 36 37 37 37 37 38 38 39 39 39 40 41 41 41 42 43 44 44 45 46 46 47 47 48 49 50 50 51 51 51 52 53 54 54...
output:
736
result:
ok 1 number(s): "736"
Test #14:
score: 0
Accepted
time: 3ms
memory: 5612kb
input:
1 3000 1 2 2 2 2 3 4 4 5 5 6 6 6 6 6 7 8 8 9 10 11 11 11 11 11 12 13 14 14 14 15 15 15 16 17 17 17 18 18 19 19 20 20 21 21 22 22 23 23 23 24 25 25 25 25 25 26 26 27 27 28 28 28 29 29 29 30 30 30 31 32 33 33 33 34 34 35 36 37 37 37 37 37 38 38 38 38 39 39 40 40 40 41 42 42 43 44 44 45 46 46 46 46 46 ...
output:
2231
result:
ok 1 number(s): "2231"
Test #15:
score: 0
Accepted
time: 61ms
memory: 10048kb
input:
1 300000 1 2 2 3 3 3 3 4 4 4 4 5 6 7 7 7 8 8 8 8 9 10 11 11 12 13 13 13 13 14 15 15 16 17 18 19 20 21 22 23 23 24 25 26 27 27 28 28 28 29 30 31 31 31 31 31 31 32 33 34 34 34 34 35 35 35 35 36 36 37 38 39 39 39 39 39 39 39 40 41 41 42 43 43 44 44 44 45 45 46 46 47 47 48 48 49 49 49 50 51 51 52 53 54 ...
output:
224979
result:
ok 1 number(s): "224979"
Test #16:
score: 0
Accepted
time: 36ms
memory: 6700kb
input:
2 100000 1 1 1 2 3 3 3 3 4 4 5 5 5 6 7 7 8 8 8 8 9 9 10 10 11 11 12 13 14 15 15 16 16 16 16 17 18 19 20 20 21 22 23 23 24 24 24 24 24 24 24 25 26 27 28 28 29 30 31 31 31 32 33 33 34 34 34 35 36 36 36 37 38 39 39 39 39 40 41 41 41 41 42 43 44 45 46 46 46 46 46 47 47 48 49 49 49 49 49 49 50 50 50 50 5...
output:
74996 74966
result:
ok 2 number(s): "74996 74966"
Test #17:
score: 0
Accepted
time: 16ms
memory: 6096kb
input:
1 300000 1000000000 999999999 999999998 999999998 999999997 999999996 999999996 999999996 999999996 999999996 999999995 999999995 999999995 999999994 999999994 999999994 999999994 999999994 999999994 999999994 999999993 999999993 999999993 999999993 999999993 999999993 999999993 999999992 999999992 ...
output:
299227
result:
ok 1 number(s): "299227"
Test #18:
score: 0
Accepted
time: 9ms
memory: 5540kb
input:
2 100000 1000000000 999999999 999999998 999999998 999999998 999999997 999999997 999999997 999999997 999999996 999999996 999999996 999999996 999999996 999999995 999999995 999999995 999999994 999999994 999999993 999999993 999999993 999999993 999999992 999999992 999999992 999999992 999999992 999999992 ...
output:
99554 99554
result:
ok 2 number(s): "99554 99554"
Test #19:
score: 0
Accepted
time: 118ms
memory: 10180kb
input:
2045 5 1 2 2 3 3 14 1 1 1 2 2 2 3 3 3 4 5 5 6 6 14 1 1 1 2 2 3 3 4 4 5 5 6 7 7 14 1 1 2 2 3 4 4 4 5 5 5 6 6 6 14 1 1 1 1 1 1 1 1 1 1 2 2 2 3 14 1 2 3 4 5 6 6 7 7 7 7 7 7 7 13 1 1 2 2 2 2 3 4 4 4 5 6 7 13 1 2 2 3 4 4 4 4 5 6 6 7 7 13 1 1 1 1 2 2 2 3 3 4 5 6 7 13 1 1 1 2 3 4 5 5 5 5 6 7 7 13 1 1 1 2 2...
output:
4 10 9 11 12 11 9 10 8 9 9 9 8 8 10 9 12 8 9 11 9 10 9 10 10 10 9 10 9 10 11 10 11 11 10 9 9 9 10 11 9 9 8 8 11 9 9 9 8 8 9 7 8 9 7 10 9 9 8 7 8 8 7 7 8 7 8 9 9 9 7 8 8 7 8 8 7 7 7 8 7 8 8 7 8 8 8 8 8 8 7 8 8 7 7 8 8 7 8 7 9 8 8 8 7 8 9 9 7 9 7 8 8 8 7 9 8 8 7 8 8 7 7 8 9 8 7 7 7 7 8 8 7 8 8 9 8 6 8...
result:
ok 2045 numbers
Test #20:
score: 0
Accepted
time: 3ms
memory: 7420kb
input:
166 5 1 2 2 3 3 14 1 1 1 2 2 2 3 3 3 4 5 5 6 6 14 1 1 1 2 2 3 3 4 4 5 5 6 7 7 14 1 1 2 2 3 4 4 4 5 5 5 6 6 6 14 1 1 1 1 1 1 1 1 1 1 2 2 2 3 14 1 2 3 4 5 6 6 7 7 7 7 7 7 7 13 1 1 2 2 2 2 3 4 4 4 5 6 7 13 1 2 2 3 4 4 4 4 5 6 6 7 7 13 1 1 1 1 2 2 2 3 3 4 5 6 7 13 1 1 1 2 3 4 5 5 5 5 6 7 7 13 1 1 1 2 2 ...
output:
4 10 9 11 12 11 9 10 8 9 9 9 8 8 10 9 12 8 9 11 9 10 9 10 10 10 9 10 9 10 11 10 11 11 10 9 9 9 10 11 9 9 8 8 11 9 9 9 8 8 9 7 8 9 7 10 9 9 8 7 8 8 7 7 8 7 8 9 9 9 7 8 8 7 8 8 7 7 7 8 7 8 8 7 8 8 8 8 8 8 7 8 8 7 7 8 8 7 8 7 9 8 8 8 7 8 9 9 7 9 7 8 8 8 7 9 8 8 7 8 8 7 7 8 9 8 7 7 7 7 8 8 7 8 8 9 8 6 8...
result:
ok 166 numbers
Test #21:
score: 0
Accepted
time: 0ms
memory: 5376kb
input:
180 5 1 2 2 3 3 14 1 1 1 2 2 2 3 3 3 4 5 5 6 6 14 1 1 1 2 2 3 3 4 4 5 5 6 7 7 14 1 1 2 2 3 4 4 4 5 5 5 6 6 6 14 1 1 1 1 1 1 1 1 1 1 2 2 2 3 14 1 2 3 4 5 6 6 7 7 7 7 7 7 7 13 1 1 2 2 2 2 3 4 4 4 5 6 7 13 1 2 2 3 4 4 4 4 5 6 6 7 7 13 1 1 1 1 2 2 2 3 3 4 5 6 7 13 1 1 1 2 3 4 5 5 5 5 6 7 7 13 1 1 1 2 2 ...
output:
4 10 9 11 12 11 9 10 8 9 9 9 8 8 10 9 12 8 9 11 9 10 9 10 10 10 9 10 9 10 11 10 11 11 10 9 9 9 10 11 9 9 8 8 11 9 9 9 8 8 9 7 8 9 7 10 9 9 8 7 8 8 7 7 8 7 8 9 9 9 7 8 8 7 8 8 7 7 7 8 7 8 8 7 8 8 8 8 8 8 7 8 8 7 7 8 8 7 8 7 9 8 8 8 7 8 9 9 7 9 7 8 8 8 7 9 8 8 7 8 8 7 7 8 9 8 7 7 7 7 8 8 7 8 8 9 8 6 8...
result:
ok 180 numbers
Test #22:
score: 0
Accepted
time: 0ms
memory: 7512kb
input:
194 5 1 2 2 3 3 14 1 1 1 2 2 2 3 3 3 4 5 5 6 6 14 1 1 1 2 2 3 3 4 4 5 5 6 7 7 14 1 1 2 2 3 4 4 4 5 5 5 6 6 6 14 1 1 1 1 1 1 1 1 1 1 2 2 2 3 14 1 2 3 4 5 6 6 7 7 7 7 7 7 7 13 1 1 2 2 2 2 3 4 4 4 5 6 7 13 1 2 2 3 4 4 4 4 5 6 6 7 7 13 1 1 1 1 2 2 2 3 3 4 5 6 7 13 1 1 1 2 3 4 5 5 5 5 6 7 7 13 1 1 1 2 2 ...
output:
4 10 9 11 12 11 9 10 8 9 9 9 8 8 10 9 12 8 9 11 9 10 9 10 10 10 9 10 9 10 11 10 11 11 10 9 9 9 10 11 9 9 8 8 11 9 9 9 8 8 9 7 8 9 7 10 9 9 8 7 8 8 7 7 8 7 8 9 9 9 7 8 8 7 8 8 7 7 7 8 7 8 8 7 8 8 8 8 8 8 7 8 8 7 7 8 8 7 8 7 9 8 8 8 7 8 9 9 7 9 7 8 8 8 7 9 8 8 7 8 8 7 7 8 9 8 7 7 7 7 8 8 7 8 8 9 8 6 8...
result:
ok 194 numbers
Test #23:
score: 0
Accepted
time: 10ms
memory: 6260kb
input:
1 300000 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1...
output:
299722
result:
ok 1 number(s): "299722"
Test #24:
score: 0
Accepted
time: 8ms
memory: 7472kb
input:
1 200000 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1...
output:
199606
result:
ok 1 number(s): "199606"
Test #25:
score: 0
Accepted
time: 9ms
memory: 5484kb
input:
1 300000 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 3 3 3...
output:
297345
result:
ok 1 number(s): "297345"
Test #26:
score: 0
Accepted
time: 12ms
memory: 8024kb
input:
1 200000 1 1 1 2 2 2 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 4 4 5 5 5 5 5 5 6 6 6 6 6 6 6 6 7 7 7 7 7 8 8 8 8 8 8 8 8 8 8 9 9 9 9 9 9 9 9 9 10 10 10 10 11 11 12 12 13 13 13 13 13 13 13 13 13 13 14 14 14 14 14 14 14 14 14 14 14 14 14 15 15 15 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 17 ...
output:
186262
result:
ok 1 number(s): "186262"
Test #27:
score: 0
Accepted
time: 99ms
memory: 14932kb
input:
1 300000 1 2 3 4 5 6 7 7 8 9 10 11 12 13 14 15 16 17 18 18 18 19 20 21 22 23 24 25 26 27 27 28 29 30 31 32 32 33 34 35 36 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 52 53 54 55 56 57 58 59 59 60 61 62 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 9...
output:
165148
result:
ok 1 number(s): "165148"
Test #28:
score: 0
Accepted
time: 61ms
memory: 11440kb
input:
1 200000 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100...
output:
100000
result:
ok 1 number(s): "100000"
Test #29:
score: 0
Accepted
time: 2ms
memory: 5444kb
input:
30 50 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 2 2 2 2 2 2 2 2 2 2 50 1 2 3 3 3 3 3 3 3 3 4 4 4 4 4 4 4 4 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 6 6 6 6 6 6 6 50 1 1 2 2 3 4 4 4 4 4 4 4 4 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 ...
output:
49 47 47 45 46 45 46 44 48 44 44 46 45 46 47 45 48 44 46 48 46 48 49 47 46 46 47 46 45 48
result:
ok 30 numbers
Test #30:
score: 0
Accepted
time: 3ms
memory: 7636kb
input:
30 500 1 1 1 1 1 1 1 1 1 1 1 1 1 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4...
output:
483 488 488 487 493 487 487 487 489 488 488 488 490 490 485 479 485 489 486 482 483 488 487 485 489 490 486 487 479 481
result:
ok 30 numbers
Test #31:
score: 0
Accepted
time: 317ms
memory: 14956kb
input:
2111 5 1 2 2 3 3 14 1 1 1 2 2 2 3 3 3 4 5 5 6 6 14 1 1 1 2 2 3 3 4 4 5 5 6 7 7 14 1 1 2 2 3 4 4 4 5 5 5 6 6 6 14 1 1 1 1 1 1 1 1 1 1 2 2 2 3 14 1 2 3 4 5 6 6 7 7 7 7 7 7 7 13 1 1 2 2 2 2 3 4 4 4 5 6 7 13 1 2 2 3 4 4 4 4 5 6 6 7 7 13 1 1 1 1 2 2 2 3 3 4 5 6 7 13 1 1 1 2 3 4 5 5 5 5 6 7 7 13 1 1 1 2 2...
output:
4 10 9 11 12 11 9 10 8 9 9 9 8 8 10 9 12 8 9 11 9 10 9 10 10 10 9 10 9 10 11 10 11 11 10 9 9 9 10 11 9 9 8 8 11 9 9 9 8 8 9 7 8 9 7 10 9 9 8 7 8 8 7 7 8 7 8 9 9 9 7 8 8 7 8 8 7 7 7 8 7 8 8 7 8 8 8 8 8 8 7 8 8 7 7 8 8 7 8 7 9 8 8 8 7 8 9 9 7 9 7 8 8 8 7 9 8 8 7 8 8 7 7 8 9 8 7 7 7 7 8 8 7 8 8 9 8 6 8...
result:
ok 2111 numbers
Test #32:
score: 0
Accepted
time: 3ms
memory: 5376kb
input:
324 5 1 2 2 3 3 14 1 1 1 2 2 2 3 3 3 4 5 5 6 6 14 1 1 1 2 2 3 3 4 4 5 5 6 7 7 14 1 1 2 2 3 4 4 4 5 5 5 6 6 6 14 1 1 1 1 1 1 1 1 1 1 2 2 2 3 14 1 2 3 4 5 6 6 7 7 7 7 7 7 7 13 1 1 2 2 2 2 3 4 4 4 5 6 7 13 1 2 2 3 4 4 4 4 5 6 6 7 7 13 1 1 1 1 2 2 2 3 3 4 5 6 7 13 1 1 1 2 3 4 5 5 5 5 6 7 7 13 1 1 1 2 2 ...
output:
4 10 9 11 12 11 9 10 8 9 9 9 8 8 10 9 12 8 9 11 9 10 9 10 10 10 9 10 9 10 11 10 11 11 10 9 9 9 10 11 9 9 8 8 11 9 9 9 8 8 9 7 8 9 7 10 9 9 8 7 8 8 7 7 8 7 8 9 9 9 7 8 8 7 8 8 7 7 7 8 7 8 8 7 8 8 8 8 8 8 7 8 8 7 7 8 8 7 8 7 9 8 8 8 7 8 9 9 7 9 7 8 8 8 7 9 8 8 7 8 8 7 7 8 9 8 7 7 7 7 8 8 7 8 8 9 8 6 8...
result:
ok 324 numbers
Test #33:
score: 0
Accepted
time: 0ms
memory: 7540kb
input:
368 5 1 2 2 3 3 14 1 1 1 2 2 2 3 3 3 4 5 5 6 6 14 1 1 1 2 2 3 3 4 4 5 5 6 7 7 14 1 1 2 2 3 4 4 4 5 5 5 6 6 6 14 1 1 1 1 1 1 1 1 1 1 2 2 2 3 14 1 2 3 4 5 6 6 7 7 7 7 7 7 7 13 1 1 2 2 2 2 3 4 4 4 5 6 7 13 1 2 2 3 4 4 4 4 5 6 6 7 7 13 1 1 1 1 2 2 2 3 3 4 5 6 7 13 1 1 1 2 3 4 5 5 5 5 6 7 7 13 1 1 1 2 2 ...
output:
4 10 9 11 12 11 9 10 8 9 9 9 8 8 10 9 12 8 9 11 9 10 9 10 10 10 9 10 9 10 11 10 11 11 10 9 9 9 10 11 9 9 8 8 11 9 9 9 8 8 9 7 8 9 7 10 9 9 8 7 8 8 7 7 8 7 8 9 9 9 7 8 8 7 8 8 7 7 7 8 7 8 8 7 8 8 8 8 8 8 7 8 8 7 7 8 8 7 8 7 9 8 8 8 7 8 9 9 7 9 7 8 8 8 7 9 8 8 7 8 8 7 7 8 9 8 7 7 7 7 8 8 7 8 8 9 8 6 8...
result:
ok 368 numbers