QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#684756#9258. Huawei Frequencies Selectionxw75pyhAC ✓28ms29220kbC++141.6kb2024-10-28 15:38:022024-10-28 15:38:02

Judging History

你现在查看的是最新测评结果

  • [2024-10-28 15:38:02]
  • 评测
  • 测评结果:AC
  • 用时:28ms
  • 内存:29220kb
  • [2024-10-28 15:38:02]
  • 提交

answer

#include<bits/stdc++.h>
using namespace std;
#define int long long
const int Maxn=2e2+10;
const int Maxm=1e3+10;
const int N=5e5+10;
const int M=2e6+10;
const int mod=1e9+7;
inline int read(){
	int x=0,f=1;char ch=getchar();
	while(ch<'0'||ch>'9'){
		if(ch=='-')f=-1;ch=getchar();
	}
	while(ch>='0'&&ch<='9'){
		x=(x<<3)+(x<<1)+(ch^48);ch=getchar();
	}
	return x*f;
} 
inline void write(int x){
	if(x<0){
		x=-x;putchar('-');
	}
	if(x>9)write(x/10);
	putchar(x%10+'0');
}
inline int ksm(int a,int b){
	int ans=1;
	while(b){
		if(b&1)ans=ans*a%mod;b>>=1;a=a*a%mod;
	}
	return ans;
} 
int n,k;int a[M];int op;
deque<int>q;int dp[M];
signed main(){
	n=read(),k=read();
	for(int i=1;i<=n;i++){
		a[i]=read();
		if(!a[i])op++;
	}
	if(op>=k){
		write(0);return 0;
	}q.push_back(0);
	memset(dp,-1,sizeof dp);dp[1]=0;
	int mx=-1;
	for(int i=2,j=0,k=0;i<=n+1;i++){
		if(a[i-1]==1){
			while(j<i-1){
				j++;
				mx=max(mx,dp[j]);
			}
		}
		if(a[i-1]==0){
			k=i;
			while(!q.empty()&&q.front()<k){
				q.pop_front();
			}
		}
		dp[i]=mx;
		if(!q.empty()){
			dp[i]=max(dp[i],dp[q.front()]);
		}
		if(dp[i]>=0)dp[i]++;
		while(!q.empty()&&dp[i]>=dp[q.back()]){
			q.pop_back();
		}
		q.push_back(i);
	}
	if(k<=dp[n+1]){
		write(1);
		return 0;
	}
	int sum=0;
	for(int i=1;i<=n;i++){
		if(a[i]==2){
			sum++;
		}
	}
	if(sum>0){
		write(2);
		return 0;
	}
	int lst=-1;
	int res=0;
	for(int i=1;i<=n;i++){
		if(a[i]<=1){
			if(a[i]!=lst){
				res++;
			}
			lst=a[i];
		}
	}
	if(k>=res){
		write(2);return 0;
	}
	write(3);
	return 0;
}

这程序好像有点Bug,我给组数据试试?

详细

Test #1:

score: 100
Accepted
time: 0ms
memory: 20640kb

input:

2 2
0 2

output:

2

result:

ok answer is '2'

Test #2:

score: 0
Accepted
time: 3ms
memory: 19584kb

input:

3 1
2 1 1

output:

1

result:

ok answer is '1'

Test #3:

score: 0
Accepted
time: 0ms
memory: 19248kb

input:

3 2
1 3 0

output:

2

result:

ok answer is '2'

Test #4:

score: 0
Accepted
time: 3ms
memory: 20872kb

input:

20 15
1 2 2 0 3 3 2 2 2 0 1 1 2 1 3 1 0 2 2 1

output:

1

result:

ok answer is '1'

Test #5:

score: 0
Accepted
time: 0ms
memory: 19584kb

input:

9 4
0 0 2 1 3 1 3 0 3

output:

1

result:

ok answer is '1'

Test #6:

score: 0
Accepted
time: 2ms
memory: 19412kb

input:

19 17
1 0 0 3 0 0 2 3 1 0 3 3 3 1 3 0 0 3 1

output:

2

result:

ok answer is '2'

Test #7:

score: 0
Accepted
time: 0ms
memory: 19548kb

input:

17 15
0 0 3 0 1 1 2 1 2 1 1 1 3 0 0 1 0

output:

2

result:

ok answer is '2'

Test #8:

score: 0
Accepted
time: 0ms
memory: 21176kb

input:

6 5
2 1 3 0 1 0

output:

2

result:

ok answer is '2'

Test #9:

score: 0
Accepted
time: 0ms
memory: 21224kb

input:

16 12
0 2 0 1 2 0 0 0 1 3 3 0 1 0 3 1

output:

2

result:

ok answer is '2'

Test #10:

score: 0
Accepted
time: 3ms
memory: 21072kb

input:

15 9
0 2 2 1 2 0 3 3 1 0 1 1 1 0 1

output:

2

result:

ok answer is '2'

Test #11:

score: 0
Accepted
time: 3ms
memory: 19332kb

input:

8 6
0 0 0 1 0 1 0 1

output:

2

result:

ok answer is '2'

Test #12:

score: 0
Accepted
time: 0ms
memory: 20340kb

input:

10 6
1 0 0 1 0 1 0 3 3 0

output:

2

result:

ok answer is '2'

Test #13:

score: 0
Accepted
time: 1ms
memory: 5632kb

input:

1 1
0

output:

0

result:

ok answer is '0'

Test #14:

score: 0
Accepted
time: 0ms
memory: 21020kb

input:

1 1
1

output:

1

result:

ok answer is '1'

Test #15:

score: 0
Accepted
time: 3ms
memory: 20316kb

input:

7 4
0 1 0 2 1 3 0

output:

2

result:

ok answer is '2'

Test #16:

score: 0
Accepted
time: 0ms
memory: 19676kb

input:

8 5
1 0 1 0 2 1 3 0

output:

2

result:

ok answer is '2'

Test #17:

score: 0
Accepted
time: 24ms
memory: 27112kb

input:

1000000 1000000
507624 225615 645997 324384 930930 165669 488080 968655 530722 293286 929521 65826 242278 483915 447838 683484 757911 811652 223115 648468 287602 113125 150435 645440 413280 788127 48622 967532 334599 130555 888316 315597 102200 535955 54735 505596 746579 99783 536797 245479 758694 9...

output:

2

result:

ok answer is '2'

Test #18:

score: 0
Accepted
time: 24ms
memory: 28356kb

input:

1000000 500000
640527 324985 387717 720881 633473 74400 8373 456149 416870 416333 184426 818743 715174 667790 988237 291161 728768 243121 382952 843840 968031 686092 262205 231513 425449 626739 319939 866653 621575 603981 27492 149201 399598 794532 45790 857851 350354 581264 270212 74658 131717 8953...

output:

2

result:

ok answer is '2'

Test #19:

score: 0
Accepted
time: 28ms
memory: 28804kb

input:

1000000 10
73144 420038 917611 893568 801708 217666 485046 278773 241462 491725 221615 905907 261631 222670 275799 46296 186210 160223 457829 675468 201493 67670 475403 941339 730587 66061 407951 919091 583209 703421 516025 269210 504246 363977 814642 129013 116508 808340 936504 920819 691219 535620...

output:

1

result:

ok answer is '1'

Test #20:

score: 0
Accepted
time: 20ms
memory: 27240kb

input:

1000000 1000000
2 0 0 3 3 3 0 2 2 2 1 2 0 1 3 3 1 0 1 2 2 2 0 1 0 3 3 0 2 2 1 3 3 0 1 1 2 3 1 2 0 0 1 2 2 0 1 1 0 3 2 1 3 1 1 2 3 3 2 1 2 0 3 1 3 1 2 1 0 0 3 1 1 2 3 0 3 1 2 3 2 3 2 1 3 1 2 1 2 0 0 0 0 3 3 0 3 0 2 2 2 2 3 0 2 2 1 3 3 3 2 3 3 0 2 2 2 2 2 1 0 2 1 3 2 0 3 0 2 3 1 0 2 2 2 1 1 3 2 0 3 2 ...

output:

2

result:

ok answer is '2'

Test #21:

score: 0
Accepted
time: 22ms
memory: 28176kb

input:

1000000 500000
2 0 3 3 2 1 2 1 2 2 3 1 1 2 3 0 0 2 0 0 1 2 3 0 1 2 1 2 0 3 2 3 1 0 1 3 0 2 1 2 2 0 1 0 0 3 2 2 0 3 0 3 2 0 1 0 1 2 1 0 0 1 3 1 1 2 2 1 1 0 1 1 2 0 0 2 3 2 1 3 0 2 0 0 0 3 2 3 1 3 2 1 3 1 0 1 2 2 0 1 3 1 1 3 2 3 3 1 3 3 0 2 1 3 0 3 2 1 1 3 2 3 3 0 3 0 1 3 2 0 2 3 1 0 1 3 3 0 2 0 3 3 3...

output:

1

result:

ok answer is '1'

Test #22:

score: 0
Accepted
time: 15ms
memory: 28872kb

input:

1000000 300000
2 1 2 0 2 2 1 2 3 1 0 3 2 1 3 3 3 1 1 1 2 0 3 2 3 2 0 1 3 1 1 1 1 1 3 3 2 0 0 0 1 2 2 1 0 3 1 3 1 0 3 3 2 2 3 2 1 3 3 2 0 3 0 3 2 0 2 3 0 2 2 3 2 0 2 0 0 1 0 2 1 0 0 0 3 0 1 3 0 1 0 2 3 1 1 1 1 0 0 3 1 0 1 2 0 2 1 2 2 3 2 2 3 3 3 2 2 2 2 0 2 2 3 3 0 3 0 3 3 3 0 3 0 3 3 1 1 3 1 1 2 1 3...

output:

1

result:

ok answer is '1'

Test #23:

score: 0
Accepted
time: 10ms
memory: 13964kb

input:

1000000 200000
1 0 1 1 2 3 3 2 3 3 3 0 1 3 1 1 2 0 3 0 3 3 2 0 2 1 2 3 1 2 1 1 1 3 0 2 0 3 2 3 3 2 3 1 0 1 2 1 1 3 3 3 3 3 2 3 0 0 2 3 2 0 3 2 2 1 0 2 2 3 2 3 3 0 3 3 0 2 0 0 1 1 0 1 0 2 2 1 0 1 3 1 1 1 2 3 1 2 2 2 2 2 3 3 1 1 1 3 1 3 0 2 2 2 2 2 3 1 0 2 0 2 2 3 0 1 2 3 1 3 1 0 3 0 2 2 1 1 0 2 3 3 0...

output:

0

result:

ok answer is '0'

Test #24:

score: 0
Accepted
time: 11ms
memory: 13824kb

input:

1000000 3
0 2 0 3 0 3 2 2 0 0 1 0 1 1 3 3 2 0 1 0 2 2 1 1 0 2 3 3 2 1 1 1 2 0 0 0 0 1 2 1 2 3 3 2 2 1 3 1 0 3 3 3 2 1 3 2 2 2 2 0 3 2 2 2 0 0 0 2 3 1 2 1 3 3 3 1 3 3 1 0 1 0 0 0 0 1 1 1 3 3 0 2 0 0 2 0 1 1 3 1 2 2 1 2 0 1 3 2 0 2 3 1 2 1 1 2 2 2 1 1 3 1 1 1 3 0 1 3 1 0 1 2 3 0 3 1 0 3 2 0 3 2 0 3 2 ...

output:

0

result:

ok answer is '0'

Test #25:

score: 0
Accepted
time: 7ms
memory: 13744kb

input:

1000000 2
1 0 1 2 3 2 3 2 2 2 2 0 2 3 2 1 2 0 3 2 3 2 2 1 0 1 2 2 3 2 3 3 3 0 3 1 0 2 0 1 3 2 3 0 3 2 0 0 1 2 0 0 1 3 1 0 2 3 2 2 2 3 1 3 0 3 3 0 0 2 3 1 2 3 3 1 3 1 1 3 3 0 3 3 1 1 0 3 2 2 1 3 3 0 0 2 2 0 1 3 1 2 0 0 3 0 0 2 1 0 3 3 3 2 0 2 0 0 0 3 1 2 1 1 2 1 2 2 3 0 1 2 1 2 3 0 3 2 0 3 1 0 1 3 1 ...

output:

0

result:

ok answer is '0'

Test #26:

score: 0
Accepted
time: 10ms
memory: 11760kb

input:

1000000 1
2 2 3 2 3 2 0 3 1 0 3 3 3 2 0 3 2 1 2 0 3 1 2 1 1 3 1 0 1 0 2 2 0 3 2 2 1 3 1 2 0 2 0 2 0 3 1 3 2 1 1 2 0 2 3 2 3 1 3 1 1 0 0 3 3 3 1 2 0 3 0 0 1 3 2 0 3 3 0 2 0 0 2 3 2 2 2 2 2 2 1 1 2 0 3 0 0 2 2 0 1 2 3 2 3 0 1 2 3 2 0 1 3 3 3 3 1 1 2 1 2 3 1 0 1 3 3 0 2 0 0 2 3 1 0 3 2 0 2 3 0 1 1 2 3 ...

output:

0

result:

ok answer is '0'

Test #27:

score: 0
Accepted
time: 7ms
memory: 11912kb

input:

1000000 500000
0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0...

output:

0

result:

ok answer is '0'

Test #28:

score: 0
Accepted
time: 8ms
memory: 13908kb

input:

1000000 500000
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0...

output:

0

result:

ok answer is '0'

Test #29:

score: 0
Accepted
time: 8ms
memory: 13772kb

input:

1000000 2
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 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:

0

result:

ok answer is '0'

Test #30:

score: 0
Accepted
time: 23ms
memory: 28460kb

input:

1000000 750334
1 2 2 0 2 2 0 2 2 2 0 2 2 1 0 0 2 0 1 2 0 0 1 2 2 1 0 2 0 0 1 0 0 0 2 1 2 2 2 0 2 2 1 0 0 0 2 1 2 2 0 2 2 2 0 2 2 1 2 1 2 0 1 2 2 0 2 2 0 2 2 0 2 2 2 1 2 0 2 2 1 2 2 0 2 1 0 2 1 2 2 0 2 1 2 2 2 0 2 2 1 2 2 2 0 2 2 1 2 0 2 0 2 2 0 2 1 2 1 2 0 0 1 2 0 0 1 0 0 2 1 0 2 1 0 0 2 1 2 0 0 0 1...

output:

1

result:

ok answer is '1'

Test #31:

score: 0
Accepted
time: 16ms
memory: 28696kb

input:

1000000 749720
1 2 2 0 2 2 0 2 2 0 2 2 2 1 2 2 2 1 2 0 2 2 0 2 1 2 2 0 2 0 2 0 2 1 2 2 2 0 2 2 1 2 1 2 2 0 2 2 2 0 2 2 0 2 2 1 2 2 2 0 2 2 1 2 2 0 2 0 2 0 2 1 2 2 2 1 2 0 2 0 2 0 2 2 1 2 0 2 0 2 0 2 2 1 2 2 0 2 2 2 0 2 2 0 2 2 1 2 2 0 2 2 2 0 2 2 0 2 2 1 2 2 0 2 2 0 2 2 2 1 2 2 0 2 1 2 2 0 2 2 2 0 2...

output:

1

result:

ok answer is '1'

Test #32:

score: 0
Accepted
time: 20ms
memory: 27740kb

input:

1000000 750503
1 2 2 0 2 2 2 0 2 2 0 2 2 1 2 0 0 1 2 2 0 2 2 2 1 2 2 0 2 1 0 0 0 2 1 2 0 2 2 0 2 1 2 0 2 2 1 2 2 0 2 2 0 2 2 2 1 2 2 2 1 2 2 0 2 1 2 2 0 2 1 2 2 2 1 2 0 2 2 1 2 0 2 0 2 2 1 0 2 0 1 2 2 1 2 2 0 2 2 2 1 2 2 0 2 2 2 1 0 0 0 2 1 2 0 2 2 0 2 1 2 2 2 0 2 2 1 2 0 2 0 2 2 1 2 2 2 1 2 0 1 2 2...

output:

1

result:

ok answer is '1'

Test #33:

score: 0
Accepted
time: 15ms
memory: 27604kb

input:

999998 571509
1 0 0 1 0 9 0 1 0 0 1 0 5 0 1 0 7 0 1 0 3 0 1 0 7 0 1 0 0 1 0 0 1 0 0 1 0 0 1 0 10 0 1 0 0 1 0 7 0 1 0 0 1 0 10 0 1 0 3 0 1 0 3 0 1 0 10 0 1 0 0 1 0 0 1 0 10 0 1 0 6 0 1 0 0 1 0 0 1 0 0 1 0 0 1 0 0 1 0 4 0 1 0 0 1 0 0 1 0 0 1 0 3 0 1 0 0 1 0 7 0 1 0 0 1 0 0 1 0 10 0 1 0 0 1 0 3 0 1 0 0...

output:

2

result:

ok answer is '2'

Test #34:

score: 0
Accepted
time: 19ms
memory: 28628kb

input:

999997 571375
1 0 0 1 0 0 1 0 0 1 0 8 0 1 0 0 1 0 3 0 1 0 10 0 1 0 7 0 1 0 0 1 0 7 0 1 0 3 0 1 0 0 1 0 0 1 0 0 1 0 0 1 0 0 1 0 0 1 0 10 0 1 0 3 0 1 0 4 0 1 0 10 0 1 0 0 1 0 0 1 0 0 1 0 0 1 0 0 1 0 0 1 0 8 0 1 0 0 1 0 0 1 0 0 1 0 4 0 1 0 4 0 1 0 7 0 1 0 0 1 0 0 1 0 0 1 0 0 1 0 4 0 1 0 0 1 0 0 1 0 0 1...

output:

2

result:

ok answer is '2'

Test #35:

score: 0
Accepted
time: 15ms
memory: 27764kb

input:

1000000 571483
1 0 0 1 0 0 1 0 0 1 0 6 0 1 0 8 0 1 0 8 0 1 0 0 1 0 0 1 0 10 0 1 0 0 1 0 0 1 0 6 0 1 0 4 0 1 0 8 0 1 0 8 0 1 0 3 0 1 0 8 0 1 0 0 1 0 0 1 0 4 0 1 0 5 0 1 0 9 0 1 0 0 1 0 0 1 0 0 1 0 0 1 0 9 0 1 0 0 1 0 3 0 1 0 7 0 1 0 0 1 0 4 0 1 0 10 0 1 0 0 1 0 0 1 0 0 1 0 0 1 0 0 1 0 0 1 0 4 0 1 0 0...

output:

2

result:

ok answer is '2'

Test #36:

score: 0
Accepted
time: 16ms
memory: 28756kb

input:

1000000 999997
1 0 2 1 2 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1...

output:

2

result:

ok answer is '2'

Test #37:

score: 0
Accepted
time: 10ms
memory: 27536kb

input:

1000000 999997
1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1...

output:

2

result:

ok answer is '2'

Test #38:

score: 0
Accepted
time: 12ms
memory: 29220kb

input:

1000000 999997
0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0...

output:

2

result:

ok answer is '2'

Test #39:

score: 0
Accepted
time: 21ms
memory: 13832kb

input:

1000000 1
0 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 ...

output:

0

result:

ok answer is '0'

Test #40:

score: 0
Accepted
time: 3ms
memory: 13836kb

input:

1000000 1
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ...

output:

0

result:

ok answer is '0'

Test #41:

score: 0
Accepted
time: 13ms
memory: 28036kb

input:

1000000 1
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 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:

1

result:

ok answer is '1'

Test #42:

score: 0
Accepted
time: 17ms
memory: 28060kb

input:

1000000 10
0 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...

output:

1

result:

ok answer is '1'

Test #43:

score: 0
Accepted
time: 8ms
memory: 13712kb

input:

1000000 10
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0...

output:

0

result:

ok answer is '0'

Test #44:

score: 0
Accepted
time: 10ms
memory: 27708kb

input:

1000000 10
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 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:

1

result:

ok answer is '1'

Test #45:

score: 0
Accepted
time: 28ms
memory: 28676kb

input:

1000000 1000000
0 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 ...

output:

2

result:

ok answer is '2'

Test #46:

score: 0
Accepted
time: 4ms
memory: 13832kb

input:

1000000 1000000
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ...

output:

0

result:

ok answer is '0'

Test #47:

score: 0
Accepted
time: 10ms
memory: 28132kb

input:

1000000 1000000
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 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:

1

result:

ok answer is '1'

Extra Test:

score: 0
Extra Test Passed