QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#153000#6828. Heirloom Paintingqzez#AC ✓70ms12540kbC++141.1kb2023-08-29 07:38:402023-08-29 07:38:41

Judging History

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

  • [2023-08-29 07:38:41]
  • 评测
  • 测评结果:AC
  • 用时:70ms
  • 内存:12540kb
  • [2023-08-29 07:38:40]
  • 提交

answer

#include<bits/stdc++.h>
#define Gc() getchar() 
#define Me(x,y) memset(x,y,sizeof(x))
#define Mc(x,y) memcpy(x,y,sizeof(x))
#define d(x,y) ((m)*(x-1)+(y))
#define R(n) (rnd()%(n)+1)
#define Pc(x) putchar(x)
#define LB lower_bound
#define UB upper_bound
#define fi first
#define se second
using namespace std;using ll=long long;using db=double;using lb=long db;using ui=unsigned;using ull=unsigned long long;using pii=pair<int,int>;using LL=__int128;
const int N=1e6+5,M=100+5,K=600+5,mod=1e9+7,Mod=mod-1;const db eps=1e-9;const int INF=1e9+7;mt19937 rnd(time(0));
int n,m,k,A[N];
void Solve(){
	int i,j;
	scanf("%d%d%d",&n,&m,&k);
	for(i=1;i<=n;i++) scanf("%d",&A[i]);
	vector<int> B;B.emplace_back(1);
	for(i=2;i<=n;i++) if(A[i]==A[i-1]) B.back()++;else B.emplace_back(1);
	if(B.size()>1&&A[1]==A[n]) B.front()+=B.back(),B.pop_back();
	int flag=0;
	for(int i:B) if(i>=k){flag=1;break;}
	if(!flag){puts("-1");return;}
	int ans=0;for(int i:B) ans+=(i+k-1)/k;
	printf("%d\n",ans);
}
int main(){
	int t;
	scanf("%d",&t);
	// t=1;
	while(t--) Solve();
	cerr<<clock()*1.0/CLOCKS_PER_SEC<<'\n';
}

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

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 1ms
memory: 4000kb

input:

3
11 4 2
1 1 1 2 2 3 3 3 4 4 1
5 2 1
1 2 1 2 1
6 2 2
1 2 1 2 1 2

output:

6
5
-1

result:

ok 3 number(s): "6 5 -1"

Test #2:

score: 0
Accepted
time: 64ms
memory: 3948kb

input:

62500
16 2 1
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
16 2 1
2 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
16 2 1
1 2 1 1 1 1 1 1 1 1 1 1 1 1 1 1
16 2 1
2 2 1 1 1 1 1 1 1 1 1 1 1 1 1 1
16 2 1
1 1 2 1 1 1 1 1 1 1 1 1 1 1 1 1
16 2 1
2 1 2 1 1 1 1 1 1 1 1 1 1 1 1 1
16 2 1
1 2 2 1 1 1 1 1 1 1 1 1 1 1 1 1
16 2 1
2 2 2 1 1 1 1 ...

output:

16
16
16
16
16
16
16
16
16
16
16
16
16
16
16
16
16
16
16
16
16
16
16
16
16
16
16
16
16
16
16
16
16
16
16
16
16
16
16
16
16
16
16
16
16
16
16
16
16
16
16
16
16
16
16
16
16
16
16
16
16
16
16
16
16
16
16
16
16
16
16
16
16
16
16
16
16
16
16
16
16
16
16
16
16
16
16
16
16
16
16
16
16
16
16
16
16
16
16
16
...

result:

ok 62500 numbers

Test #3:

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

input:

3036
16 2 1
1 1 2 1 1 2 1 1 1 1 2 1 2 2 2 2
16 2 1
2 1 2 1 1 2 1 1 1 1 2 1 2 2 2 2
16 2 1
1 2 2 1 1 2 1 1 1 1 2 1 2 2 2 2
16 2 1
2 2 2 1 1 2 1 1 1 1 2 1 2 2 2 2
16 2 1
1 1 1 2 1 2 1 1 1 1 2 1 2 2 2 2
16 2 1
2 1 1 2 1 2 1 1 1 1 2 1 2 2 2 2
16 2 1
1 2 1 2 1 2 1 1 1 1 2 1 2 2 2 2
16 2 1
2 2 1 2 1 2 1 1...

output:

16
16
16
16
16
16
16
16
16
16
16
16
16
16
16
16
16
16
16
16
16
16
16
16
16
16
16
16
16
16
16
16
16
16
16
16
16
16
16
16
16
16
16
16
16
16
16
16
16
16
16
16
16
16
16
16
16
16
16
16
16
16
16
16
16
16
16
16
16
16
16
16
16
16
16
16
16
16
16
16
16
16
16
16
16
16
16
16
16
16
16
16
16
16
16
16
16
16
16
16
...

result:

ok 3036 numbers

Test #4:

score: 0
Accepted
time: 64ms
memory: 4016kb

input:

62500
16 2 2
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
16 2 2
2 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
16 2 2
1 2 1 1 1 1 1 1 1 1 1 1 1 1 1 1
16 2 2
2 2 1 1 1 1 1 1 1 1 1 1 1 1 1 1
16 2 2
1 1 2 1 1 1 1 1 1 1 1 1 1 1 1 1
16 2 2
2 1 2 1 1 1 1 1 1 1 1 1 1 1 1 1
16 2 2
1 2 2 1 1 1 1 1 1 1 1 1 1 1 1 1
16 2 2
2 2 2 1 1 1 1 ...

output:

8
9
9
8
9
10
8
9
9
9
10
9
8
9
9
8
9
10
9
9
10
11
9
10
8
9
9
9
9
10
8
9
9
9
10
9
9
10
9
9
10
10
11
10
9
10
10
9
8
9
9
8
9
10
9
9
9
9
10
9
8
9
9
8
9
10
9
9
10
11
9
10
9
10
10
10
9
10
9
9
10
11
10
10
11
12
10
11
9
10
10
10
10
11
9
10
8
9
9
9
9
10
8
9
9
10
10
10
9
10
9
9
9
10
9
9
10
11
9
10
8
9
9
9
9
10...

result:

ok 62500 numbers

Test #5:

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

input:

3036
16 2 2
1 1 2 1 1 2 1 1 1 1 2 1 2 2 2 2
16 2 2
2 1 2 1 1 2 1 1 1 1 2 1 2 2 2 2
16 2 2
1 2 2 1 1 2 1 1 1 1 2 1 2 2 2 2
16 2 2
2 2 2 1 1 2 1 1 1 1 2 1 2 2 2 2
16 2 2
1 1 1 2 1 2 1 1 1 1 2 1 2 2 2 2
16 2 2
2 1 1 2 1 2 1 1 1 1 2 1 2 2 2 2
16 2 2
1 2 1 2 1 2 1 1 1 1 2 1 2 2 2 2
16 2 2
2 2 1 2 1 2 1 1...

output:

10
11
10
10
11
11
12
11
10
11
11
10
9
10
10
9
10
11
10
10
10
10
11
10
9
10
10
9
10
11
11
10
11
12
11
11
11
11
12
11
10
11
11
10
11
12
12
11
12
13
12
12
11
11
12
11
11
12
11
11
10
10
11
10
10
11
10
10
11
11
12
11
10
11
11
10
10
11
11
10
11
12
11
11
10
10
11
10
10
11
10
10
10
10
11
10
10
11
10
10
11
1...

result:

ok 3036 numbers

Test #6:

score: 0
Accepted
time: 59ms
memory: 3880kb

input:

62500
16 2 3
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
16 2 3
2 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
16 2 3
1 2 1 1 1 1 1 1 1 1 1 1 1 1 1 1
16 2 3
2 2 1 1 1 1 1 1 1 1 1 1 1 1 1 1
16 2 3
1 1 2 1 1 1 1 1 1 1 1 1 1 1 1 1
16 2 3
2 1 2 1 1 1 1 1 1 1 1 1 1 1 1 1
16 2 3
1 2 2 1 1 1 1 1 1 1 1 1 1 1 1 1
16 2 3
2 2 2 1 1 1 1 ...

output:

6
6
6
6
6
8
6
6
6
7
8
7
6
7
6
6
6
7
7
7
8
9
7
7
6
7
7
7
6
7
6
6
6
8
7
7
7
9
7
7
8
9
9
9
7
9
7
8
6
7
7
7
7
9
7
7
6
7
7
7
6
8
6
6
6
7
8
7
7
8
7
6
7
8
9
8
7
8
7
7
8
8
9
8
9
10
9
8
7
8
9
8
7
8
8
7
6
7
7
6
7
8
7
6
7
8
9
8
7
8
7
7
6
6
7
6
7
8
7
6
6
7
8
7
6
7
6
6
6
7
7
7
8
9
7
7
7
8
8
8
7
8
6
7
7
8
8
8
9
1...

result:

ok 62500 numbers

Test #7:

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

input:

3036
16 2 3
1 1 2 1 1 2 1 1 1 1 2 1 2 2 2 2
16 2 3
2 1 2 1 1 2 1 1 1 1 2 1 2 2 2 2
16 2 3
1 2 2 1 1 2 1 1 1 1 2 1 2 2 2 2
16 2 3
2 2 2 1 1 2 1 1 1 1 2 1 2 2 2 2
16 2 3
1 1 1 2 1 2 1 1 1 1 2 1 2 2 2 2
16 2 3
2 1 1 2 1 2 1 1 1 1 2 1 2 2 2 2
16 2 3
1 2 1 2 1 2 1 1 1 1 2 1 2 2 2 2
16 2 3
2 2 1 2 1 2 1 1...

output:

10
10
10
9
10
10
12
10
10
10
10
9
9
8
10
8
10
10
10
9
8
8
10
8
9
9
9
8
8
8
10
8
9
9
9
8
9
9
11
9
9
9
9
8
10
9
11
9
11
11
11
10
9
9
11
9
9
9
10
8
8
8
9
7
9
9
9
8
9
9
11
9
9
9
9
8
8
7
9
7
9
9
9
8
8
8
10
8
8
8
8
7
9
8
10
8
10
10
10
9
9
9
11
9
9
9
9
8
10
9
11
9
11
11
11
10
9
9
11
9
9
9
10
8
10
10
11
9
1...

result:

ok 3036 numbers

Test #8:

score: 0
Accepted
time: 63ms
memory: 4000kb

input:

62500
16 2 4
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
16 2 4
2 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
16 2 4
1 2 1 1 1 1 1 1 1 1 1 1 1 1 1 1
16 2 4
2 2 1 1 1 1 1 1 1 1 1 1 1 1 1 1
16 2 4
1 1 2 1 1 1 1 1 1 1 1 1 1 1 1 1
16 2 4
2 1 2 1 1 1 1 1 1 1 1 1 1 1 1 1
16 2 4
1 2 2 1 1 1 1 1 1 1 1 1 1 1 1 1
16 2 4
2 2 2 1 1 1 1 ...

output:

4
5
5
5
5
7
5
5
5
6
7
6
5
6
5
4
5
6
6
6
7
8
6
6
5
6
6
6
5
6
4
5
5
6
6
6
6
8
6
6
7
8
8
8
6
8
6
6
5
6
6
6
6
8
6
6
5
6
6
6
4
6
5
5
5
7
6
6
6
8
6
6
6
8
8
8
6
8
6
6
7
8
8
8
8
10
8
8
6
8
8
8
6
8
6
7
5
6
6
6
6
8
6
6
6
8
8
8
6
8
6
6
5
6
6
6
6
8
6
6
4
6
6
6
5
7
5
5
5
6
7
6
6
7
6
5
6
7
8
7
6
7
6
5
6
7
8
7
8
9...

result:

ok 62500 numbers

Test #9:

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

input:

3036
16 2 4
1 1 2 1 1 2 1 1 1 1 2 1 2 2 2 2
16 2 4
2 1 2 1 1 2 1 1 1 1 2 1 2 2 2 2
16 2 4
1 2 2 1 1 2 1 1 1 1 2 1 2 2 2 2
16 2 4
2 2 2 1 1 2 1 1 1 1 2 1 2 2 2 2
16 2 4
1 1 1 2 1 2 1 1 1 1 2 1 2 2 2 2
16 2 4
2 1 1 2 1 2 1 1 1 1 2 1 2 2 2 2
16 2 4
1 2 1 2 1 2 1 1 1 1 2 1 2 2 2 2
16 2 4
2 2 1 2 1 2 1 1...

output:

8
9
8
7
8
9
10
9
8
9
8
7
6
7
8
7
8
9
8
7
6
7
8
7
6
7
7
6
7
8
8
7
8
9
8
7
8
9
10
9
8
9
8
7
8
9
10
9
10
11
10
9
8
9
10
9
8
9
8
8
7
7
8
7
8
9
8
7
8
9
10
9
8
9
8
7
6
7
8
7
8
9
8
7
6
7
8
7
7
8
7
6
7
8
9
8
8
9
8
7
8
9
10
9
8
9
8
7
8
9
10
9
10
11
10
9
8
9
10
9
8
9
8
8
9
9
10
9
10
11
10
9
10
11
12
11
10
11
...

result:

ok 3036 numbers

Test #10:

score: 0
Accepted
time: 67ms
memory: 4004kb

input:

62500
16 2 5
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
16 2 5
2 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
16 2 5
1 2 1 1 1 1 1 1 1 1 1 1 1 1 1 1
16 2 5
2 2 1 1 1 1 1 1 1 1 1 1 1 1 1 1
16 2 5
1 1 2 1 1 1 1 1 1 1 1 1 1 1 1 1
16 2 5
2 1 2 1 1 1 1 1 1 1 1 1 1 1 1 1
16 2 5
1 2 2 1 1 1 1 1 1 1 1 1 1 1 1 1
16 2 5
2 2 2 1 1 1 1 ...

output:

4
4
4
4
4
6
4
4
4
6
6
6
4
6
4
4
4
6
6
6
6
8
6
6
4
6
6
6
4
6
4
4
4
5
6
5
6
7
6
5
6
7
8
7
6
7
6
5
4
5
6
5
6
7
6
5
4
5
6
5
4
5
4
4
4
5
5
5
6
7
5
5
6
7
7
7
6
7
5
5
6
7
7
7
8
9
7
7
6
7
7
7
6
7
5
5
4
5
5
5
6
7
5
5
6
7
7
7
6
7
5
5
4
5
5
5
6
7
5
5
4
5
5
5
4
5
4
4
4
6
5
5
5
7
5
5
6
7
7
7
5
7
5
5
6
7
7
7
7
9
...

result:

ok 62500 numbers

Test #11:

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

input:

3036
16 2 5
1 1 2 1 1 2 1 1 1 1 2 1 2 2 2 2
16 2 5
2 1 2 1 1 2 1 1 1 1 2 1 2 2 2 2
16 2 5
1 2 2 1 1 2 1 1 1 1 2 1 2 2 2 2
16 2 5
2 2 2 1 1 2 1 1 1 1 2 1 2 2 2 2
16 2 5
1 1 1 2 1 2 1 1 1 1 2 1 2 2 2 2
16 2 5
2 1 1 2 1 2 1 1 1 1 2 1 2 2 2 2
16 2 5
1 2 1 2 1 2 1 1 1 1 2 1 2 2 2 2
16 2 5
2 2 1 2 1 2 1 1...

output:

-1
8
-1
7
-1
8
-1
9
-1
8
-1
7
-1
6
-1
7
-1
8
-1
7
-1
6
-1
7
-1
6
6
5
7
6
-1
7
-1
8
-1
7
-1
8
-1
9
-1
8
-1
7
-1
8
-1
9
-1
10
-1
9
-1
8
-1
9
-1
8
-1
7
6
6
-1
7
-1
8
-1
7
-1
8
-1
9
-1
8
-1
7
-1
6
-1
7
-1
8
-1
7
-1
6
-1
7
6
6
7
6
7
7
8
7
-1
8
-1
7
-1
8
-1
9
-1
8
-1
7
-1
8
-1
9
-1
10
-1
9
-1
8
-1
9
-1
8
...

result:

ok 3036 numbers

Test #12:

score: 0
Accepted
time: 56ms
memory: 3880kb

input:

62500
16 2 6
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
16 2 6
2 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
16 2 6
1 2 1 1 1 1 1 1 1 1 1 1 1 1 1 1
16 2 6
2 2 1 1 1 1 1 1 1 1 1 1 1 1 1 1
16 2 6
1 1 2 1 1 1 1 1 1 1 1 1 1 1 1 1
16 2 6
2 1 2 1 1 1 1 1 1 1 1 1 1 1 1 1
16 2 6
1 2 2 1 1 1 1 1 1 1 1 1 1 1 1 1
16 2 6
2 2 2 1 1 1 1 ...

output:

3
4
4
4
4
6
4
4
4
5
6
5
4
5
4
3
4
5
5
5
6
7
5
5
4
5
5
5
4
5
3
3
4
5
5
5
5
7
5
5
6
7
7
7
5
7
5
5
4
5
5
5
5
7
5
5
4
5
5
5
3
5
3
3
4
5
5
5
5
7
5
5
5
7
7
7
5
7
5
5
6
7
7
7
7
9
7
7
5
7
7
7
5
7
5
5
4
5
5
5
5
7
5
5
5
7
7
7
5
7
5
5
4
5
5
5
5
7
5
5
3
5
5
5
3
5
3
4
4
5
5
5
5
7
5
5
5
7
7
7
5
7
5
5
5
7
7
7
7
9
...

result:

ok 62500 numbers

Test #13:

score: 0
Accepted
time: 53ms
memory: 4020kb

input:

62500
16 2 15
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
16 2 15
2 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
16 2 15
1 2 1 1 1 1 1 1 1 1 1 1 1 1 1 1
16 2 15
2 2 1 1 1 1 1 1 1 1 1 1 1 1 1 1
16 2 15
1 1 2 1 1 1 1 1 1 1 1 1 1 1 1 1
16 2 15
2 1 2 1 1 1 1 1 1 1 1 1 1 1 1 1
16 2 15
1 2 2 1 1 1 1 1 1 1 1 1 1 1 1 1
16 2 15
2 2 2 ...

output:

2
2
2
-1
2
-1
-1
-1
2
-1
-1
-1
-1
-1
-1
-1
2
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
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
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...

result:

ok 62500 numbers

Test #14:

score: 0
Accepted
time: 60ms
memory: 4016kb

input:

62500
16 2 16
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
16 2 16
2 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
16 2 16
1 2 1 1 1 1 1 1 1 1 1 1 1 1 1 1
16 2 16
2 2 1 1 1 1 1 1 1 1 1 1 1 1 1 1
16 2 16
1 1 2 1 1 1 1 1 1 1 1 1 1 1 1 1
16 2 16
2 1 2 1 1 1 1 1 1 1 1 1 1 1 1 1
16 2 16
1 2 2 1 1 1 1 1 1 1 1 1 1 1 1 1
16 2 16
2 2 2 ...

output:

1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-...

result:

ok 62500 numbers

Test #15:

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

input:

3036
16 2 16
1 1 2 1 1 2 1 1 1 1 2 1 2 2 2 2
16 2 16
2 1 2 1 1 2 1 1 1 1 2 1 2 2 2 2
16 2 16
1 2 2 1 1 2 1 1 1 1 2 1 2 2 2 2
16 2 16
2 2 2 1 1 2 1 1 1 1 2 1 2 2 2 2
16 2 16
1 1 1 2 1 2 1 1 1 1 2 1 2 2 2 2
16 2 16
2 1 1 2 1 2 1 1 1 1 2 1 2 2 2 2
16 2 16
1 2 1 2 1 2 1 1 1 1 2 1 2 2 2 2
16 2 16
2 2 1 2...

output:

-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
...

result:

ok 3036 numbers

Test #16:

score: 0
Accepted
time: 46ms
memory: 8024kb

input:

1
999996 5 10
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 4 4 4 4 4 4 4 4 4 4 4 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 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 4 4 4 4 4 4 4 4 4 4 4 4 4 2 2 2 2 2 2 2 2 2 2 2 2 2 2 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:

122055

result:

ok 1 number(s): "122055"

Test #17:

score: 0
Accepted
time: 42ms
memory: 8188kb

input:

1
999989 5 10
5 5 5 5 5 5 5 5 5 5 5 5 5 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 3 3 3 3 3 3 3 3 3 3 3 3 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 3 3 3 3 3 3 3 3 3 3 3 3 3 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 4 4 ...

output:

122344

result:

ok 1 number(s): "122344"

Test #18:

score: 0
Accepted
time: 59ms
memory: 7892kb

input:

1
999917 1000000 100
880996 880996 880996 880996 880996 880996 880996 880996 880996 880996 880996 880996 880996 880996 880996 880996 880996 880996 880996 880996 880996 880996 880996 880996 880996 880996 880996 880996 880996 880996 880996 880996 880996 880996 880996 880996 880996 880996 880996 880996...

output:

13292

result:

ok 1 number(s): "13292"

Test #19:

score: 0
Accepted
time: 66ms
memory: 7996kb

input:

1
999953 1000000 100
877398 877398 877398 877398 877398 877398 877398 877398 877398 877398 877398 877398 877398 877398 877398 877398 877398 877398 877398 877398 877398 877398 877398 877398 877398 877398 877398 877398 877398 877398 877398 877398 877398 877398 877398 877398 877398 877398 877398 877398...

output:

13245

result:

ok 1 number(s): "13245"

Test #20:

score: 0
Accepted
time: 50ms
memory: 7948kb

input:

1
999408 1000000 1000
465591 465591 465591 465591 465591 465591 465591 465591 465591 465591 465591 465591 465591 465591 465591 465591 465591 465591 465591 465591 465591 465591 465591 465591 465591 465591 465591 465591 465591 465591 465591 465591 465591 465591 465591 465591 465591 465591 465591 46559...

output:

1336

result:

ok 1 number(s): "1336"

Test #21:

score: 0
Accepted
time: 62ms
memory: 8044kb

input:

1
994353 1000000 10000
34098 34098 34098 34098 34098 34098 34098 34098 34098 34098 34098 34098 34098 34098 34098 34098 34098 34098 34098 34098 34098 34098 34098 34098 34098 34098 34098 34098 34098 34098 34098 34098 34098 34098 34098 34098 34098 34098 34098 34098 34098 34098 34098 34098 34098 34098 3...

output:

130

result:

ok 1 number(s): "130"

Test #22:

score: 0
Accepted
time: 62ms
memory: 7612kb

input:

1
933043 1000000 100000
224325 224325 224325 224325 224325 224325 224325 224325 224325 224325 224325 224325 224325 224325 224325 224325 224325 224325 224325 224325 224325 224325 224325 224325 224325 224325 224325 224325 224325 224325 224325 224325 224325 224325 224325 224325 224325 224325 224325 224...

output:

12

result:

ok 1 number(s): "12"

Test #23:

score: 0
Accepted
time: 60ms
memory: 7824kb

input:

1
994769 1000000 500000
277976 277976 277976 277976 277976 277976 277976 277976 277976 277976 277976 277976 277976 277976 277976 277976 277976 277976 277976 277976 277976 277976 277976 277976 277976 277976 277976 277976 277976 277976 277976 277976 277976 277976 277976 277976 277976 277976 277976 277...

output:

2

result:

ok 1 number(s): "2"

Test #24:

score: 0
Accepted
time: 46ms
memory: 7768kb

input:

1
895242 1000000 500000
560586 560586 560586 560586 560586 560586 560586 560586 560586 560586 560586 560586 560586 560586 560586 560586 560586 560586 560586 560586 560586 560586 560586 560586 560586 560586 560586 560586 560586 560586 560586 560586 560586 560586 560586 560586 560586 560586 560586 560...

output:

-1

result:

ok 1 number(s): "-1"

Test #25:

score: 0
Accepted
time: 57ms
memory: 8072kb

input:

1
1000000 1000000 985319
114514 114514 114514 114514 114514 114514 114514 114514 114514 114514 114514 114514 114514 114514 114514 114514 114514 114514 114514 114514 114514 114514 114514 114514 114514 114514 114514 114514 114514 114514 114514 114514 114514 114514 114514 114514 114514 114514 114514 11...

output:

2

result:

ok 1 number(s): "2"

Test #26:

score: 0
Accepted
time: 70ms
memory: 7780kb

input:

1
1000000 1000000 1000000
114514 114514 114514 114514 114514 114514 114514 114514 114514 114514 114514 114514 114514 114514 114514 114514 114514 114514 114514 114514 114514 114514 114514 114514 114514 114514 114514 114514 114514 114514 114514 114514 114514 114514 114514 114514 114514 114514 114514 1...

output:

1

result:

ok 1 number(s): "1"

Test #27:

score: 0
Accepted
time: 65ms
memory: 7904kb

input:

1
1000000 1000000 514
114514 114514 114514 114514 114514 114514 114514 114514 114514 114514 114514 114514 114514 114514 114514 114514 114514 114514 114514 114514 114514 114514 114514 114514 114514 114514 114514 114514 114514 114514 114514 114514 114514 114514 114514 114514 114514 114514 114514 11451...

output:

1946

result:

ok 1 number(s): "1946"

Test #28:

score: 0
Accepted
time: 55ms
memory: 12540kb

input:

1
1000000 1000000 7
19 13 25 40 35 31 13 15 13 24 30 15 6 20 35 26 13 13 37 5 26 30 28 10 40 32 32 26 7 31 30 29 24 23 36 12 31 37 10 39 9 30 4 35 6 25 14 16 2 32 27 18 15 8 40 14 8 10 16 7 32 38 20 5 20 35 25 13 20 26 31 29 4 27 10 29 32 9 17 38 18 17 2 12 19 19 23 3 28 25 2 15 13 11 17 16 26 28 7 ...

output:

-1

result:

ok 1 number(s): "-1"

Test #29:

score: 0
Accepted
time: 47ms
memory: 12020kb

input:

1
1000000 1000000 12
36 31 24 39 11 22 1 14 32 21 20 1 22 16 31 26 30 35 28 12 38 38 4 33 27 5 25 3 15 26 15 16 23 21 30 24 11 40 22 31 32 32 18 12 40 7 24 13 8 33 23 39 7 39 13 7 7 3 4 26 6 9 10 4 17 28 39 8 23 34 29 12 37 5 34 29 33 8 26 2 27 30 20 32 15 23 27 40 6 29 31 15 33 21 12 20 2 22 34 17 ...

output:

-1

result:

ok 1 number(s): "-1"

Test #30:

score: 0
Accepted
time: 38ms
memory: 12360kb

input:

1
1000000 1000000 5
26 34 34 8 28 23 31 37 24 5 9 11 13 9 23 19 16 40 2 13 13 29 18 28 25 26 4 4 30 38 2 27 24 26 39 35 15 26 19 30 9 27 37 32 37 26 19 14 1 14 32 27 5 20 40 10 32 12 25 16 35 11 14 31 10 23 16 29 8 36 40 1 22 24 18 23 14 32 38 38 30 30 10 8 9 15 16 8 29 8 18 32 12 40 21 26 13 4 14 3...

output:

-1

result:

ok 1 number(s): "-1"

Test #31:

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

input:

1
1 1 1
1

output:

1

result:

ok 1 number(s): "1"

Test #32:

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

input:

6
1 9 1
9
9 1 1
1 1 1 1 1 1 1 1 1
2 1 1
1 1
2 1 2
1 1
2 9 2
8 8
3 3 2
1 2 3

output:

1
9
2
1
1
-1

result:

ok 6 numbers