QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#313566#8141. DigitsPetroTarnavskyi#AC ✓475ms326000kbC++203.5kb2024-01-24 20:40:432024-01-24 20:40:44

Judging History

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

  • [2024-01-24 20:40:44]
  • 评测
  • 测评结果:AC
  • 用时:475ms
  • 内存:326000kb
  • [2024-01-24 20:40:43]
  • 提交

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;

const int mod = 1e9 + 9;
int mult(int a, int b)
{
	return (LL) a * b % mod;
}
int add(int a, int b)
{
	return a + b < mod ? a + b : a + b - mod;
}
int sub(int a, int b)
{
	return a - b >= 0 ? a - b : a - b + mod;
}
void updAdd(int& a, int b)
{
	a += b;
	if(a >= mod)
		a -= mod;
}

const int N = 174;
//[l, r)
string s[N][N];
//[l, r), [isRight][pos][left]
int dp[N][N][2][N][9];

void solve()
{
	int n;
	cin >> n;
	VI a(n);
	FOR(i, 0, n)
		cin >> a[i];
	FOR(l, 0, n)
	{
		int sum = 0;
		FOR(r, l, n + 1)
		{
			if(r == l)
				s[l][r] = "";
			else
				s[l][r] = to_string(sum);
				
			if(r != n)
				sum += a[r];
		
		}
	}
	FOR(l, 0, n)
	FOR(r, l, n + 1)
	FOR(k, 0, 2)
	FOR(pos, 0, n + 1)
	FOR(len, 0, 9)
		dp[l][r][k][pos][len] = 0;
		
	dp[0][n][0][0][0] = 1;
	
	FOR(l, 0, n)
	{		
		RFOR(r, n + 1, l)
		{
			FOR(pos, 0, n + 1)
			{
				FOR(len, 0, 9)
				{	
					//isRight = 0;
					if(dp[l][r][0][pos][len] != 0)
					{						
						int val = dp[l][r][0][pos][len];
						assert(SZ(s[pos][l]) >= len);		
						FOR(k, l, r)
						{
							if(SZ(s[k][r]) > len)
							{
								string L = s[pos][l].substr(SZ(s[pos][l]) - len, len);
								string R = s[k][r].substr(SZ(s[k][r]) - len, len);
								
								reverse(ALL(L));
								if(L == R)
								{
									updAdd(dp[l][k][1][r][SZ(s[k][r]) - len], val);
								}
								continue;
							}
							else
							{
						//cout << "here1" << endl;
						//cout << SZ(s[pos][l]) << " " << len << " " << SZ(s[k][r]) << endl;
								string L = s[pos][l].substr(SZ(s[pos][l]) - len, SZ(s[k][r]));
								string R = s[k][r];
								
						//cout << "ok1" << endl;
								reverse(ALL(L));
								if(L == R)
									updAdd(dp[l][k][0][pos][len - SZ(s[k][r])], val);
								continue;
							}
						}
					}
					//isRight = 1
					if(dp[l][r][1][pos][len] != 0)
					{						
						int val = dp[l][r][1][pos][len];
						
						FOR(k, l + 1, r + 1)
						{
							if(SZ(s[l][k]) >= len)
							{
								string L = s[r][pos].substr(0, len);
								string R = s[l][k].substr(0, len);
								
								reverse(ALL(L));
								if(L == R)
									updAdd(dp[k][r][0][l][SZ(s[l][k]) - len], val);
								continue;
							}
							else
							{
								string L = s[r][pos].substr(len - SZ(s[l][k]), SZ(s[l][k]));
								string R = s[l][k];
								
								reverse(ALL(L));
								if(L == R)
									updAdd(dp[k][r][1][pos][len - SZ(s[l][k])], val);
								continue;
							}
						}
					}
				}
			}
		}
	}
	int ans = 0;
	FOR(l, 0, n)
		FOR(k, 0, 2)
			FOR(pos, 0, n + 1)
				FOR(len, 0, 9)
					{
						if(dp[l][l][k][pos][len] == 0)
							continue;
						string cur;
						if(k == 0)
						{
							cur = s[pos][l].substr(SZ(s[pos][l]) - len, len);
						}
						else
						{
							cur = s[l][pos].substr(0, len);
						}
						string rcur = cur;
						reverse(ALL(rcur));
						if(rcur == cur)
							updAdd(ans, dp[l][l][k][pos][len]);
					}
	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: 20948kb

input:

5
2
123456 654321
5
0 0 0 0 0
6
1 1 1 1 1 1
7
1 1 4 5 1 4 1
9
1 2 3 1 1 1 2 1 1

output:

2
16
8
4
6

result:

ok 5 number(s): "2 16 8 4 6"

Test #2:

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

input:

13
7
0 0 4 2 3 3 0
12
3 2 1 0 1 4 3 1 4 4 1 1
12
1 1 2 4 2 4 4 4 4 2 4 1
11
2 0 3 3 3 2 4 1 4 2 4
8
2 3 3 3 3 3 1 4
13
1 2 3 1 1 4 4 0 2 2 1 3 0
6
3 2 1 0 3 4
13
4 0 0 2 4 2 0 2 3 4 1 0 2
12
0 4 0 3 1 1 1 2 2 1 4 0
9
4 1 0 2 4 2 0 0 0
11
0 3 2 0 4 3 1 0 0 3 2
12
0 1 0 1 3 1 2 1 1 0 2 1
12
4 2 2 1 4 ...

output:

3
6
3
1
7
27
0
4
26
0
19
9
6

result:

ok 13 numbers

Test #3:

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

input:

100
1
23232
51
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
1
121
1
0
1
233
1
666666
1
134131
1
133331
1
100001
1
110011
1
101101
1
112121
1
120202
1
102201
1
606606
1
654321
1
123456
1
114514
1
91919
1
1234
1
43234
1
4323
1
13331
1
233332
1
2...

output:

1
56971182
1
1
0
1
0
1
1
1
1
0
0
1
1
0
0
0
1
0
1
0
1
1
0
0
0
0
0
0
1
1
1
0
0
1
1
1
1
1
1
1
1
1
1
1
1
0
0
1
0
1
0
1
0
1
0
0
0
0
0
1
0
1
0
0
0
1
0
0
0
0
0
1
0
0
0
1
0
1
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
1
0
0

result:

ok 100 numbers

Test #4:

score: 0
Accepted
time: 44ms
memory: 293776kb

input:

1
150
1661 2 85240 23709 41081 667 46074 76212 998 364034 4503 91401 24361 3763 82 8395 38388 487 914 3644 4744 99779 184640 194345 213497 217644 269992 311857 349347 369580 410390 414561 544163 553920 561556 594593 231 40614 49245 51903 81655 139511 143038 180131 194366 250429 304722 332007 410643 ...

output:

2

result:

ok 1 number(s): "2"

Test #5:

score: 0
Accepted
time: 34ms
memory: 294560kb

input:

1
150
84496 91583 117509 168677 178152 186049 208496 209975 232369 237550 237910 248903 288026 302903 306407 306988 325526 333102 346167 351551 355251 368033 378096 383870 394246 415510 424709 446152 454205 459463 460766 484571 485563 495345 524497 524613 528122 58749 85915 157737 168173 202370 2217...

output:

3

result:

ok 1 number(s): "3"

Test #6:

score: 0
Accepted
time: 34ms
memory: 271144kb

input:

1
150
61817 67014 104744 105596 137072 145612 158169 177583 178191 184303 188815 205487 211479 212778 214540 218731 219275 223035 224256 237494 237874 239510 239765 246314 247825 249018 262773 272513 280844 291196 292395 308705 312845 319768 326047 337355 344686 348823 349075 357505 360496 361398 37...

output:

1

result:

ok 1 number(s): "1"

Test #7:

score: 0
Accepted
time: 90ms
memory: 290524kb

input:

1
150
666666 666666 666666 666666 666666 666666 666666 666666 666666 666666 666666 666666 666666 666666 666666 666666 666666 666666 666666 666666 666666 666666 666666 666666 666666 666666 666666 666666 666666 666666 666666 666666 666666 666666 666666 666666 666666 666666 666666 666666 666666 666666 ...

output:

881788852

result:

ok 1 number(s): "881788852"

Test #8:

score: 0
Accepted
time: 89ms
memory: 289244kb

input:

3
150
0 1 2 0 0 1 3 0 5 0 1 5 0 0 1 2 1 0 2 1 1 1 3 0 2 3 3 1 5 1 2 2 1 2 0 2 0 1 0 0 0 1 6 0 1 5 0 4 2 2 0 0 0 1 3 2 4 3 4 1 1 1 1 1 1 6 0 1 0 1 8 3 1 1 1 4 0 1 0 1 1 1 0 2 3 2 2 4 3 1 4 1 0 0 3 0 2 2 2 2 3 0 2 0 2 5 1 0 2 1 2 2 2 0 1 4 5 0 1 0 0 3 2 2 4 0 2 2 1 0 4 0 3 0 3 0 4 5 0 0 0 1 0 1 1 0 1 ...

output:

734709974
2302
2

result:

ok 3 number(s): "734709974 2302 2"

Test #9:

score: 0
Accepted
time: 91ms
memory: 289516kb

input:

3
150
0 3 0 1 1 0 2 1 3 2 5 6 4 3 4 3 8 1 0 0 0 4 2 0 2 4 1 0 0 2 3 0 0 0 2 5 7 0 0 1 4 2 4 0 5 2 4 2 0 1 3 0 2 0 1 2 1 2 0 4 0 2 0 2 1 0 1 0 2 1 0 1 7 0 3 0 4 3 3 0 6 0 1 3 5 0 3 3 3 0 0 3 1 4 4 2 2 5 0 1 0 1 1 4 0 1 6 3 0 3 0 1 1 4 1 2 1 0 4 1 3 2 0 0 1 2 2 1 4 4 1 3 3 9 1 1 0 6 1 1 0 3 0 5 0 2 1 ...

output:

327967593
124
4

result:

ok 3 number(s): "327967593 124 4"

Test #10:

score: 0
Accepted
time: 382ms
memory: 290772kb

input:

5
12
0 0 0 0 0 0 0 0 0 0 0 0
150
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 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:

2048
292864101
179869031
1
2

result:

ok 5 number(s): "2048 292864101 179869031 1 2"

Test #11:

score: 0
Accepted
time: 82ms
memory: 325000kb

input:

3
150
2 1 2 0 0 4 6 0 1 0 2 1 2 0 2 4 0 3 1 0 1 8 3 1 0 1 2 4 3 2 3 4 3 1 2 7 5 3 2 0 0 1 2 7 3 0 4 6 1 0 1 0 1 0 0 1 0 0 1 0 3 1 0 2 2 3 2 0 4 2 1 4 9 2 3 0 5 2 1 1 0 1 0 6 3 6 4 5 1 1 0 1 0 0 3 0 1 1 4 2 2 1 2 1 3 0 0 2 0 1 2 3 6 2 0 1 1 3 5 1 0 1 0 0 1 1 1 0 2 2 0 1 0 2 0 1 4 1 0 1 3 1 7 0 0 3 1 ...

output:

650167074
2569
5

result:

ok 3 number(s): "650167074 2569 5"

Test #12:

score: 0
Accepted
time: 75ms
memory: 323832kb

input:

3
150
4 5 0 2 0 7 1 2 1 1 1 0 0 1 2 0 1 0 0 0 2 2 0 0 0 1 3 0 1 3 3 1 2 5 4 2 1 0 3 0 3 2 1 1 2 6 7 8 1 1 0 0 0 6 0 1 4 4 0 0 0 1 1 3 6 1 2 3 1 3 0 2 0 1 1 2 2 2 1 0 2 0 2 2 0 6 3 0 2 0 0 3 2 3 3 2 1 0 0 1 2 1 4 0 3 0 0 1 4 2 1 1 3 0 3 1 1 0 1 1 3 0 2 3 1 1 0 0 6 0 0 1 1 3 2 0 0 2 1 1 1 4 3 1 2 2 1 ...

output:

53846777
76083
2

result:

ok 3 number(s): "53846777 76083 2"

Test #13:

score: 0
Accepted
time: 79ms
memory: 325784kb

input:

3
150
0 2 1 0 0 0 4 2 0 0 7 2 1 5 0 1 0 0 5 1 2 0 4 7 2 0 3 6 0 3 3 1 1 4 1 0 1 3 1 0 2 0 4 4 1 5 1 2 0 0 1 1 0 1 0 1 0 1 1 0 0 2 0 5 0 4 1 1 0 1 2 0 0 3 1 4 0 4 2 1 0 0 3 1 1 0 4 0 5 6 0 2 2 0 2 2 1 3 0 2 5 2 0 1 0 4 2 0 3 0 1 0 1 0 2 0 1 2 0 1 1 2 2 0 0 0 1 2 2 2 4 2 3 0 1 1 1 0 5 0 2 7 1 0 1 3 1 ...

output:

368709596
8301
1

result:

ok 3 number(s): "368709596 8301 1"

Test #14:

score: 0
Accepted
time: 39ms
memory: 325748kb

input:

10
1
44
3
130999 191551 345216
5
7490 5021 37976 413496 424454
150
4482 13422 37275 66213 85139 90628 151638 172249 296867 312942 317882 381994 392026 408243 475627 506034 534509 543369 568314 573455 581581 613924 88874 6880 7455 6624 43271 12 94361 12 549 594 83479 396 6307 3699 5929 67 526078 245 ...

output:

1
1
1
2
1
1
1
1
1
1

result:

ok 10 numbers

Test #15:

score: 0
Accepted
time: 475ms
memory: 324852kb

input:

2
150
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 100000 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 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:

637662036
302650031

result:

ok 2 number(s): "637662036 302650031"

Test #16:

score: 0
Accepted
time: 83ms
memory: 324652kb

input:

3
150
0 0 4 3 1 1 2 1 2 1 1 3 4 0 3 4 3 1 3 3 1 2 3 3 2 0 3 2 2 5 2 0 1 0 2 2 2 2 0 1 0 5 0 5 0 5 0 3 2 0 2 0 0 0 0 2 2 3 1 0 2 1 0 3 0 1 3 2 4 3 2 0 1 4 0 1 1 4 4 3 1 1 2 3 3 0 2 0 4 0 1 4 5 2 1 2 5 0 2 1 3 0 7 3 3 5 0 3 1 2 1 0 0 0 1 0 0 0 5 2 4 0 0 2 3 5 2 1 5 3 5 3 2 1 4 3 3 2 0 3 1 0 0 4 2 4 0 ...

output:

395639134
12471
5

result:

ok 3 number(s): "395639134 12471 5"

Test #17:

score: 0
Accepted
time: 244ms
memory: 324928kb

input:

2
150
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 600006 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 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:

337826402
527091883

result:

ok 2 number(s): "337826402 527091883"

Test #18:

score: 0
Accepted
time: 253ms
memory: 325680kb

input:

2
150
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 500005 600006 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 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:

807630745
699257163

result:

ok 2 number(s): "807630745 699257163"

Test #19:

score: 0
Accepted
time: 243ms
memory: 325532kb

input:

2
150
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 400004 300003 400004 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 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:

807630745
527091883

result:

ok 2 number(s): "807630745 527091883"

Test #20:

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

input:

1
150
101010 101010 101010 101010 101010 101010 101010 101010 101010 101010 101010 101010 101010 101010 101010 101010 101010 101010 101010 101010 101010 101010 101010 101010 101010 101010 101010 101010 101010 101010 101010 101010 101010 101010 101010 101010 101010 101010 101010 101010 101010 101010 ...

output:

26036080

result:

ok 1 number(s): "26036080"

Test #21:

score: 0
Accepted
time: 248ms
memory: 325680kb

input:

2
150
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 100000 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 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:

83141319
135916003

result:

ok 2 number(s): "83141319 135916003"

Test #22:

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

input:

1
150
0 0 0 0 0 100000 0 0 0 0 0 0 0 0 0 0 100000 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 100000 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 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:

150595820

result:

ok 1 number(s): "150595820"

Test #23:

score: 0
Accepted
time: 93ms
memory: 325788kb

input:

3
150
2 4 0 0 5 0 3 2 1 0 2 4 2 0 1 1 1 0 0 0 2 0 1 0 5 0 3 0 2 2 0 0 4 1 1 2 0 2 0 1 1 0 2 5 2 0 2 0 0 1 1 1 1 6 1 0 0 0 1 5 2 2 0 7 3 3 3 0 0 3 0 4 0 0 3 1 4 2 2 3 4 2 0 1 1 0 2 5 4 2 2 2 2 0 0 1 5 3 0 2 0 3 4 1 0 3 6 2 3 1 0 1 2 4 2 0 2 5 3 0 0 0 0 0 0 5 0 0 1 5 1 2 2 1 2 1 0 0 1 1 5 1 1 0 0 1 6 ...

output:

437398252
6111
4

result:

ok 3 number(s): "437398252 6111 4"

Test #24:

score: 0
Accepted
time: 34ms
memory: 325108kb

input:

10
1
44
3
163104 41222 529011
5
33651 134650 7828 336941 70315
150
182193 69606 460070 386932 492222 389301 337171 95127 568306 238473 321394 117666 365301 745 4617 185905 315582 151371 455047 545981 142547 329238 498726 628716 175130 118688 75559 18 512351 8459 826 98588 771 9310 3 757 684 287215 3...

output:

1
1
2
1
1
1
2
1
1
1

result:

ok 10 numbers

Test #25:

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

input:

10
1
88
3
55366 55372 160434
5
53694 34025 10539 18501 62738
150
44 176738 524830 42140 2931 52269 109 96791 69546 5514 8 207 64294 52 131970 515617 416422 495863 255263 43155 426510 518103 399039 86016 251541 71020 496997 355672 188474 229329 5240 130523 185451 497205 229359 21194 93039 508713 4662...

output:

1
1
1
1
1
1
1
1
1
1

result:

ok 10 numbers

Test #26:

score: 0
Accepted
time: 43ms
memory: 323784kb

input:

10
1
8
3
15011 15641 6111
5
935 2648 51081 107081 121729
150
31447 5 8843 2531 5921 45 1103 429 4040 3234 924 756 569 770 91 35263 9 866 33 90169 177 5384 84643 59181 64085 77845 24522 16828 886 10891 806 12868 5354 9551 8155 95531 97724 5245 29815 30740 9174 62884 77120 55466 88689 65648 8903 76 55...

output:

1
1
1
2
1
1
2
1
1
1

result:

ok 10 numbers

Test #27:

score: 0
Accepted
time: 40ms
memory: 325964kb

input:

10
1
8
3
640 189 5166
5
1704 4905 591 172 2737
150
762 509 792 3865 371 64 25664 5 3 75 6052 129609 161992 228511 344 56 858 987 1 2642 227250 149525 43647 62055 8502 72938 279240 53604 5476 176 54 4676 740 8 187 82508 23473 199 5 873 4553 57359 73 73 212 84 703 4564 12662 146 54307 4821 2373 795 37...

output:

1
1
1
1
1
1
1
1
2
1

result:

ok 10 numbers

Test #28:

score: 0
Accepted
time: 35ms
memory: 325236kb

input:

10
1
1
3
466 942 2035
5
8 134611 83470 14912 137745
150
7 599 529 996 8 4 8625 229 7664 9536 1 2371 6116 70 932 2 794 226 25 6758 116 4021 7571 3990 59 35 28 523 92520 63 346 5406 55 9785 65624 13164 110937 96151 71642 10471 62009 35326 119981 54553 33278 60678 119886 10153 87847 93432 42117 43426 1...

output:

1
1
1
1
1
1
1
1
1
1

result:

ok 10 numbers

Test #29:

score: 0
Accepted
time: 35ms
memory: 325068kb

input:

10
1
5
3
190 222 143
5
17 133 2082 94 1062
150
54 78 4577 53 889 29 128 103 1 32 9809 381 836 1234 919 8 361 5 1 8 28 4 4836 197 28551 1181 9883 31958 44169 7099 43627 17297 27223 3456 3390 3954 28777 37195 22914 17991 40534 21956 43909 30160 5458 44144 24083 58 5194 35810 3468 38400 11074 32188 441...

output:

1
1
1
3
1
1
1
2
1
1

result:

ok 10 numbers

Test #30:

score: 0
Accepted
time: 36ms
memory: 325796kb

input:

10
1
6
3
290 281 206
5
48 143 154 275 12
150
8944 93 189 5 60 9 998 17 18 68 88 9 611 859 7 62 292 93 484 33 445 12 2376 76 2727 27 54 9 447 34 2 69 80 863 19989 3221 2140 18680 4215 11243 7490 2952 50 399 6 36 808 9 6 2 4 3 74 49 45 7 272 7267 673 22 15 4 4 3 34 843 9 2 92 267 958 1 1 698 88 9333 1...

output:

1
1
1
4
1
1
1
2
1
1

result:

ok 10 numbers

Test #31:

score: 0
Accepted
time: 48ms
memory: 324944kb

input:

10
1
1
3
110 279 237
5
71 127 190 78 222
150
294 54 97 2110 963 1889 1879 873 76 97 8 352 67 1 32 7 8 9 37 7 976 139 1586 94 1 5 7 6 12 12 229 9 1643 1803 2157 921 578 1681 1119 1176 195 1065 1067 1308 248 989 369 230 253 106 980 198 59 165 168 1845 1593 1977 1605 644 2076 850 2054 334 1073 1259 198...

output:

1
1
1
8
2
1
1
1
2
1

result:

ok 10 numbers

Test #32:

score: 0
Accepted
time: 36ms
memory: 325256kb

input:

10
1
0
3
5 1 16
5
43 21 0 30 16
150
7 3 32 24 6823 1 4142 2 96 99 51 8 4 74 8 51 81 7 50 7 5 4 4 81 53 65 194 14 92 289 32 84 42 63 45 919 4 8 8 9 9 8 849 1 954 362 448 2 39 8 2 2941 4 9 1 5 63 5 1 5027 16637 2166 10542 29884 9716 21526 11013 3626 27454 14622 1521 3228 23965 920 5163 26913 5469 5634...

output:

1
2
3
13
1
0
1
1
1
1

result:

ok 10 numbers

Test #33:

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

input:

10
1
0
3
10 33 1
5
41 46 3 21 54
150
5 71 6 1 7 98 42 442 73 3 8 32 6 369 275 411 1 89 28 1 125 315 16 414 433 391 217 401 222 231 187 131 84 323 321 106 253 97 370 336 79 78 249 349 333 91 79 99 26 24 40 103 121 122 345 3 13 55 93 3 42 72 8 95 207 5 44 3 94 51 5 4 93 4 127 182 36 97 147 88 275 121 ...

output:

1
1
1
49
1
0
1
1
1
1

result:

ok 10 numbers

Test #34:

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

input:

10
1
0
3
2 6 36
5
26 6 36 39 47
150
2 23 15 58 26 9 492 74 223 42 91 3 85 314 550 171 556 3 5 91 9 64 8 327 6 13 1 270 25 69 154 191 240 58 103 419 427 376 146 126 213 544 434 154 163 13 34 523 18 221 392 436 12 161 536 274 408 35 205 212 227 493 44 43 6 98 94 116 165 495 9 277 285 3 3 3 6 32 3 6 33...

output:

1
2
1
53
1
1
2
2
4
1

result:

ok 10 numbers

Test #35:

score: 0
Accepted
time: 52ms
memory: 325604kb

input:

10
1
0
3
52 4 32
5
50 9 59 2 34
150
2 7 5 3 38 44 77 68 4 1069 952 688 352 1074 362 348 747 40 656 7 4 5 2 70 869 597 819 2 1 3 3 87 8 2 39 8 95 87 3 2 394 1023 172 1075 906 847 150 354 633 197 285 521 608 983 232 907 450 848 118 914 224 346 696 954 87 742 960 494 343 436 757 762 299 788 311 411 629...

output:

1
1
1
191
2
0
2
1
4
1

result:

ok 10 numbers

Test #36:

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

input:

10
1
0
3
15 50 23
5
4 31 23 12 7
150
6 96 7 8 2 7 5 90 153 1 3 6 3 246 3 72 2 2 7 7 4 8 2 1 7 43 4 32 4 4 1 4 10 9 59 99 39 154 71 9 129 112 433 76 233 351 424 401 414 45 285 361 273 20 28 30 242 142 128 167 151 322 247 324 19 263 293 156 328 242 335 419 115 7 41 74 345 171 137 23 21 47 18 7 79 51 7...

output:

1
1
2
11936
2
0
4
1
2
0

result:

ok 10 numbers

Test #37:

score: 0
Accepted
time: 44ms
memory: 326000kb

input:

10
1
0
3
14 0 8
5
10 26 18 6 6
150
11 3 67 25 10 84 26 47 28 71 24 26 45 56 43 1 6 57 24 79 43 4 6 69 7 5 7 90 6 2 7 22 6 1 9 1 7 65 15 2 72 73 13 25 38 42 20 41 85 43 83 60 54 58 35 64 1 32 24 84 36 32 89 81 37 59 39 11 68 67 12 13 11 30 52 82 46 27 5 35 1 7 1 29 27 57 3 1 8 6 6 68 1 37 5 7 2 80 12...

output:

1
1
2
1544
2
1
2
1
5
0

result:

ok 10 numbers

Test #38:

score: 0
Accepted
time: 61ms
memory: 323616kb

input:

10
1
0
3
0 0 7
5
8 20 31 10 37
150
6 5 3 26 4 9 6 5 51 0 31 7 28 35 31 6 1 3 3 8 6 56 2 7 5 1 3 4 5 9 2 3 29 58 24 13 1 34 27 7 4 16 35 55 35 20 9 13 21 44 41 20 57 27 34 39 36 41 2 3 57 13 5 58 11 35 21 2 31 22 10 8 52 2 47 2 3 5 11 38 41 5 31 56 39 38 5 9 8 9 5 8 3 49 13 4 5 3 7 8 27 32 16 3 2 8 2...

output:

1
1
1
73494
1
0
1
1
9
0

result:

ok 10 numbers

Test #39:

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

input:

10
1
0
3
0 1 5
5
3 7 23 28 15
150
2 8 9 1 8 3 25 13 36 9 8 8 4 6 6 8 9 14 35 34 2 2 9 3 35 29 10 1 9 7 9 1 7 8 4 3 16 0 15 25 6 7 1 34 29 15 6 1 6 1 6 7 6 5 5 6 23 22 31 1 33 3 9 16 6 8 7 1 7 6 6 5 3 2 35 11 6 10 34 31 27 25 21 11 20 4 34 20 19 10 5 36 4 35 0 34 6 22 16 13 6 21 8 18 29 13 22 19 8 24...

output:

1
1
1
49987
7
1
6
1
23
1

result:

ok 10 numbers

Test #40:

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

input:

10
1
0
3
2 1 1
5
0 0 0 2 2
150
3 8 21 11 13 19 19 11 10 8 19 11 12 19 18 15 12 10 18 12 7 17 12 10 16 2 7 3 9 8 17 19 17 9 19 18 20 2 4 3 4 3 7 9 19 9 5 3 6 4 4 9 7 1 8 5 7 9 15 6 8 8 2 1 7 16 0 1 7 6 2 16 20 0 8 5 3 2 4 9 3 1 5 1 5 1 3 9 4 2 3 5 8 8 6 7 1 2 5 1 8 11 17 15 17 9 5 6 4 2 7 5 8 1 7 9 4...

output:

1
2
2
6614668
5
1
2
1
19
1

result:

ok 10 numbers

Test #41:

score: 0
Accepted
time: 80ms
memory: 323936kb

input:

10
1
0
3
2 0 0
5
3 3 0 4 2
150
2 6 1 8 3 3 1 0 11 11 9 10 0 3 2 6 9 8 9 7 0 11 2 8 1 6 7 3 3 7 4 5 1 2 7 3 6 7 3 3 3 2 2 2 5 0 2 9 9 1 8 0 5 3 5 12 11 9 1 10 8 4 10 10 2 2 12 5 3 6 6 2 6 2 2 6 2 2 10 3 12 0 2 4 11 7 11 4 4 4 7 9 5 2 2 2 3 5 9 3 9 1 6 7 6 3 7 2 1 5 4 7 3 3 7 6 1 8 1 12 4 9 2 3 6 0 11...

output:

1
1
3
733906507
5
1
8
1
69
1

result:

ok 10 numbers

Test #42:

score: 0
Accepted
time: 98ms
memory: 323740kb

input:

10
1
0
3
1 2 1
5
0 5 2 0 7
150
4 4 3 6 6 6 2 0 6 3 3 6 3 5 1 1 4 1 3 1 6 5 2 5 2 3 3 1 3 6 4 4 4 2 1 4 5 2 5 2 1 6 4 5 4 1 4 2 2 1 3 6 2 5 0 3 3 1 2 6 1 2 5 6 6 2 1 4 0 5 4 6 4 2 6 2 7 3 4 1 4 5 1 2 5 1 1 2 6 6 7 4 5 7 2 5 4 1 2 1 7 4 6 3 1 3 3 2 5 4 6 6 6 1 3 2 1 7 5 1 7 6 7 5 1 7 0 1 1 3 1 4 1 1 5...

output:

1
2
3
471822388
32
1
5
1
16
1

result:

ok 10 numbers

Test #43:

score: 0
Accepted
time: 90ms
memory: 325964kb

input:

10
1
0
3
1 0 1
5
4 2 0 2 4
150
4 3 2 4 2 2 3 0 3 2 3 4 2 4 3 1 3 4 0 4 1 3 4 4 3 3 2 1 0 3 3 2 3 4 1 1 0 4 1 2 4 1 1 5 0 4 4 2 4 4 5 5 5 1 5 0 1 2 1 3 3 3 2 5 2 0 0 2 2 4 2 2 4 4 3 4 1 2 3 4 1 4 3 4 3 5 1 0 1 0 1 0 5 4 5 3 5 1 1 4 3 1 1 5 5 5 3 5 3 0 3 0 3 3 3 1 0 0 2 5 5 1 5 3 0 2 3 3 5 4 4 3 5 4 1...

output:

1
4
7
772930504
17
1
16
2
117
1

result:

ok 10 numbers

Test #44:

score: 0
Accepted
time: 97ms
memory: 325744kb

input:

10
1
0
3
1 0 0
5
4 1 0 2 3
150
3 1 1 3 4 2 4 4 2 3 2 0 1 4 1 4 4 4 2 4 4 2 1 1 0 4 0 2 1 4 1 0 1 4 1 2 3 2 2 2 4 4 1 4 2 1 4 1 1 3 4 3 3 3 4 1 2 1 3 2 2 2 3 1 1 1 1 4 2 4 1 1 3 2 1 4 0 2 1 2 3 2 1 4 1 3 2 3 4 1 4 2 4 3 3 3 0 3 2 4 2 1 2 3 4 2 0 3 3 3 3 2 4 2 4 4 4 2 4 4 2 1 4 4 2 4 4 0 1 1 1 1 0 4 1...

output:

1
1
3
599828472
9
1
2
1
2
1

result:

ok 10 numbers

Test #45:

score: 0
Accepted
time: 89ms
memory: 323568kb

input:

10
1
0
3
0 1 0
5
1 1 0 2 0
150
3 3 3 2 1 1 1 4 1 4 2 0 4 2 4 3 4 1 2 3 1 4 1 2 2 4 2 3 3 1 1 1 2 4 4 1 3 0 4 3 3 4 4 3 3 3 3 1 3 1 3 3 4 3 4 0 4 0 2 1 0 1 3 0 3 2 3 1 4 2 1 4 3 3 2 0 1 1 4 2 1 1 3 4 1 3 4 1 4 0 3 3 0 3 4 3 1 4 3 2 1 3 0 3 4 4 3 4 1 1 1 3 1 3 1 1 3 3 4 1 5 0 0 5 4 5 5 1 4 5 2 4 4 5 3...

output:

1
2
4
943919705
13
1
1
1
12
1

result:

ok 10 numbers

Test #46:

score: 0
Accepted
time: 83ms
memory: 323844kb

input:

10
1
0
3
0 2 7
5
4 4 0 4 4
150
5 3 1 0 3 5 2 1 4 4 4 2 4 2 4 2 2 0 0 5 3 2 3 4 1 2 0 4 2 1 1 2 3 3 4 4 2 4 5 4 2 2 2 4 2 0 2 2 5 2 5 0 4 1 5 0 1 4 3 0 4 5 3 3 5 2 2 5 0 1 1 2 5 4 2 1 0 4 1 0 1 2 5 0 2 2 3 3 5 1 5 4 2 0 0 0 5 3 3 5 1 1 0 0 3 5 1 3 4 2 3 2 3 0 1 2 5 0 0 2 0 4 2 1 0 4 3 1 6 4 0 4 1 3 5...

output:

1
1
7
484121447
4
1
6
1
8
1

result:

ok 10 numbers

Test #47:

score: 0
Accepted
time: 39ms
memory: 325324kb

input:

1
150
197481 253821 497009 314814 175043 6421 5 37307 95956 7520 41087 44787 83 41 897 96034 17394 96621 610295 580264 32599 50 224991 232138 245517 275131 311018 318399 318711 360384 379093 405842 425188 455181 468496 491440 510157 510525 535073 554511 557056 575864 49762 59759 87 6 946 7 23465 419...

output:

1

result:

ok 1 number(s): "1"

Test #48:

score: 0
Accepted
time: 39ms
memory: 325640kb

input:

1
150
2698 51338 94870 16821 316578 355215 467 36057 8658 6007 4889 128 433453 1220 479578 44582 69210 864 301 158 325000 339489 83625 540 35 94535 2941 58 339351 522531 232 4398 291403 321696 485185 246395 602579 194752 510054 322653 486673 82431 65939 14175 319772 559838 55765 425320 315774 35614 ...

output:

1

result:

ok 1 number(s): "1"

Test #49:

score: 0
Accepted
time: 32ms
memory: 325812kb

input:

1
150
65 73186 84827 257096 342603 289784 126040 428338 420169 428720 93194 367220 163196 169584 1192 198115 47792 466605 144881 53243 179793 185004 357288 347146 415623 65908 129881 458619 423904 95505 329274 168026 238000 454484 10821 123174 302675 263592 447620 376395 312493 272287 169825 111681 ...

output:

1

result:

ok 1 number(s): "1"

Test #50:

score: 0
Accepted
time: 32ms
memory: 325160kb

input:

1
150
2220 1691 44 90296 240871 147654 409662 11859 527916 494349 176619 351685 525354 529591 472498 236635 344370 1197 3062 554169 218475 593975 2884 173393 16123 503621 233094 477623 318656 192857 635110 515995 621582 402323 202936 490 296875 3648 377340 238536 420162 10221 66156 449367 80838 2032...

output:

1

result:

ok 1 number(s): "1"

Test #51:

score: 0
Accepted
time: 36ms
memory: 325616kb

input:

1
150
39 363639 53634 60127 2246 276396 8267 78926 28821 43930 43177 600606 626016 478658 238131 164900 29732 281594 122775 568742 229477 486413 28274 97529 798 440748 373235 270498 341248 224123 348167 501978 595561 545747 117563 115821 97717 168728 608956 248024 473496 326729 629711 323857 464275 ...

output:

1

result:

ok 1 number(s): "1"

Test #52:

score: 0
Accepted
time: 32ms
memory: 325648kb

input:

1
150
166222 263654 493076 483653 48190 115728 57965 136516 203146 511152 479997 560220 579392 18413 131842 104316 451012 417 320654 455445 312863 152984 9787 338183 308183 465001 624123 159708 439752 63565 427536 426866 562819 293651 181624 450976 455958 428 89660 630131 460556 144109 150993 326862...

output:

1

result:

ok 1 number(s): "1"

Test #53:

score: 0
Accepted
time: 45ms
memory: 324652kb

input:

1
150
188597 482269 156796 314441 95206 470650 556416 652505 583055 315 360312 161964 498971 593876 193652 550402 11626 489707 44884 598212 126206 566461 326131 243511 366147 559648 152909 240218 661739 520933 361255 20444 209975 461185 26909 362585 193079 206945 295467 454507 42994 78429 107496 301...

output:

1

result:

ok 1 number(s): "1"

Test #54:

score: 0
Accepted
time: 33ms
memory: 325376kb

input:

1
150
202211 70506 363867 103847 159018 208017 162060 394765 75120 406921 115084 196684 78428 353918 185464 429896 427588 181154 392702 408153 274447 46049 401975 397523 2059 307476 321013 198565 296601 231948 24889 308752 401549 178781 116798 261320 259347 168454 393727 417570 247589 232994 204815 ...

output:

1

result:

ok 1 number(s): "1"

Test #55:

score: 0
Accepted
time: 35ms
memory: 325728kb

input:

1
150
88938 106312 110956 170625 210469 218221 225981 226084 232043 237351 249129 261138 264150 296777 328067 339505 346122 352085 368242 383275 389135 392051 398854 412138 413557 421917 441276 443207 451180 466277 469935 486679 490881 513954 524387 545083 77983 85683 88997 91764 103462 112403 12744...

output:

1

result:

ok 1 number(s): "1"

Test #56:

score: 0
Accepted
time: 241ms
memory: 325996kb

input:

2
150
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 555556 555555 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 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:

807630745
822684420

result:

ok 2 number(s): "807630745 822684420"

Extra Test:

score: 0
Extra Test Passed