QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#450713#6828. Heirloom PaintingPetroTarnavskyi#AC ✓48ms13268kbC++201.0kb2024-06-22 17:19:112024-06-22 17:19:12

Judging History

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

  • [2024-06-22 17:19:12]
  • 评测
  • 测评结果:AC
  • 用时:48ms
  • 内存:13268kb
  • [2024-06-22 17:19:11]
  • 提交

answer

#include <bits/stdc++.h>

using namespace std;

#define FOR(i, a, b) for(int i = (a); i < (b); i++)
#define RFOR(i, a, b) for(int i = (a) - 1; i >= (b); i--)
#define SZ(a) int(a.size())
#define ALL(a) a.begin(), a.end()
#define PB push_back
#define MP make_pair
#define F first
#define S second

typedef long long LL;
typedef vector<int> VI;
typedef pair<int, int> PII;
typedef double db;

void solve()
{
	int n, t, k;
	cin >> n >> t >> k;
	VI lens;
	VI a(n);
	FOR (i, 0, n)
		cin >> a[i];
	int x = 1;
	FOR (i, 1, n)
	{
		if (a[i] != a[i - 1])
		{
			lens.PB(x);
			x = 1;
		}
		else
			x++;
	}
	if (a.back() == a[0])
	{
		if (lens.empty())
			lens.PB(x);
		else
			lens[0] += x;
	}
	else
		lens.PB(x);
	int mx = *max_element(ALL(lens));
	if (mx < k)
		cout << -1 << '\n';
	else
	{
		int ans = 0;
		FOR (i, 0, SZ(lens))
		{
			ans += (lens[i] + k - 1) / k;
		}
		cout << ans << '\n';
	}
}

int main()
{
	ios::sync_with_stdio(0);
	cin.tie(0);
	
	int t;
	cin >> t;
	while (t--)
		solve();
	
	return 0;
}

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

Details

Tip: Click on the bar to expand more detailed information

Test #1:

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

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: 45ms
memory: 3624kb

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: 3ms
memory: 3792kb

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: 45ms
memory: 3508kb

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: 3ms
memory: 3664kb

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: 45ms
memory: 3628kb

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: 3ms
memory: 3820kb

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: 45ms
memory: 3568kb

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: 2ms
memory: 3852kb

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: 45ms
memory: 3624kb

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: 3ms
memory: 3660kb

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: 45ms
memory: 3512kb

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: 41ms
memory: 3788kb

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: 46ms
memory: 3628kb

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: 3ms
memory: 3596kb

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: 30ms
memory: 7620kb

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: 25ms
memory: 7616kb

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: 46ms
memory: 6952kb

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: 45ms
memory: 7356kb

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: 43ms
memory: 7068kb

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: 46ms
memory: 6944kb

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: 39ms
memory: 6824kb

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: 48ms
memory: 7012kb

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: 42ms
memory: 6680kb

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: 38ms
memory: 6948kb

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: 43ms
memory: 6976kb

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: 42ms
memory: 7012kb

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: 29ms
memory: 13268kb

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: 38ms
memory: 13236kb

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: 30ms
memory: 12740kb

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: 0ms
memory: 3612kb

input:

1
1 1 1
1

output:

1

result:

ok 1 number(s): "1"

Test #32:

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

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