QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#638594#4929. Longest Unfriendly Subsequencejinzikai3148 289ms7948kbC++142.1kb2024-10-13 16:19:242024-10-13 16:19:25

Judging History

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

  • [2024-10-13 16:19:25]
  • 评测
  • 测评结果:8
  • 用时:289ms
  • 内存:7948kb
  • [2024-10-13 16:19:24]
  • 提交

answer

#include<iostream>
#include<vector>
#include<algorithm>
#include<cstring>
#define int ll
#define lc (rt<<1)
#define rc (rt<<1|1)
#define mid (l+r>>1)
#define rg register
#define pb push_back
#define ppb pop_back
#define mkp make_pair
#define prq_mn(x) priority_queue<x, vector<x>, greater<x> >
#define prq_mx(x) priority_queue<x, vector<x>, less<x> >
#define fi first
#define se second
#define DEBUG printf("Debug on line %d\n", __LINE__)
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> pii;
const int N = 5e2 + 5;
const int INF = 0x3f3f3f3f;

template <typename T> bool updmax(T& a, T b) {return a<b ? a=b, 1 : 0;}
template <typename T> bool updmin(T& a, T b) {return a>b ? a=b, 1 : 0;}

inline int read(){
	int n=0, f=1; char ch = getchar();
	for(; !isdigit(ch); ch=getchar()) if(ch == '-') f=-1;
	for(; isdigit(ch); ch=getchar()) n=n*10+ch-'0';
	return n*f;
}

int T;
int n, m;
int a[N];
vector<int> vec; 
int f[2][N][N];

signed main(){
	T = read();
	while(T--){
		vec.clear();
		
		n = read();
		for(int i=1; i<=n; i++){
			a[i] = read();
			vec.pb(a[i]);
		}
		
		sort(vec.begin(), vec.end());
		vec.erase(unique(vec.begin(), vec.end()), vec.end());
		m = vec.size();
		for(int i=1; i<=n; i++){
			a[i] = lower_bound(vec.begin(), vec.end(), a[i]) - vec.begin() + 1;
//			printf("a[%d] = %d\n", i, a[i]);
		}
		
		memset(f, -INF, sizeof f);
		f[0][0][0] = 0;
		for(int ii=1; ii<=n; ii++){
			int i=ii&1, lst = (ii-1)&1;
			for(int j=0; j<=m; j++){
				for(int k=0; k<=m; k++){
					f[i][j][k] = max(f[i][j][k], f[lst][j][k]);
					if(a[ii]!=j && a[ii]!=k) f[i][a[ii]][j] = max(f[i][a[ii]][j], f[lst][j][k] + 1);
				}
			}
			
			memset(f[lst], -INF, sizeof f[lst]);
//			for(int j=0; j<=m; j++){
//				for(int k=0; k<=m; k++){
//					printf("f[%d][%d][%d] = %d\n", ii, j, k, f[i][j][k]);
//				}
//				printf("\n");
//			}
		}
		
		int ans = -INF;
		for(int j=0; j<=m; j++){
			for(int k=0; k<=m; k++){
				ans = max(ans, f[n&1][j][k]);
			}
		}
		printf("%lld\n", ans);
	}
}

Details

Tip: Click on the bar to expand more detailed information

Subtask #1:

score: 0
Runtime Error

Test #1:

score: 0
Runtime Error

input:

1
200000
259021863 259021863 259021863 259021863 259021863 259021863 259021863 259021863 259021863 259021863 259021863 259021863 259021863 259021863 259021863 259021863 259021863 259021863 259021863 259021863 259021863 259021863 259021863 259021863 259021863 259021863 259021863 259021863 259021863 2...

output:


result:


Subtask #2:

score: 0
Time Limit Exceeded

Test #15:

score: 6
Accepted
time: 3ms
memory: 7760kb

input:

3
5
1 2 1 2 1
7
1 2 3 2 1 2 3
8
1 10 10 1 1 100 100 1

output:

2
6
4

result:

ok 3 lines

Test #16:

score: 0
Time Limit Exceeded

input:

28653
6
372076545 832760265 372076545 644300403 644300403 644300403
8
540046638 375129642 863244619 863244619 375129642 540046638 540046638 540046638
6
142783193 508154499 871683432 71368434 871683432 871683432
8
760894385 984189193 760894385 323542350 984189193 760894385 323542350 323542350
6
84093...

output:

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

result:


Subtask #3:

score: 8
Accepted

Test #19:

score: 8
Accepted
time: 35ms
memory: 7760kb

input:

1
500
537076440 691668159 871942500 537076440 537076440 691668159 871942500 871942500 537076440 691668159 871942500 537076440 691668159 871942500 537076440 691668159 871942500 537076440 691668159 871942500 537076440 691668159 871942500 871942500 537076440 691668159 871942500 537076440 537076440 6916...

output:

361

result:

ok single line: '361'

Test #20:

score: 8
Accepted
time: 35ms
memory: 7816kb

input:

1
500
584142119 101442702 335815880 584142119 101442702 335815880 584142119 101442702 335815880 584142119 101442702 335815880 584142119 101442702 101442702 335815880 335815880 584142119 584142119 101442702 101442702 335815880 584142119 101442702 335815880 584142119 101442702 335815880 584142119 1014...

output:

394

result:

ok single line: '394'

Test #21:

score: 8
Accepted
time: 34ms
memory: 7812kb

input:

1
500
296341737 806184542 989331127 989331127 296341737 806184542 455929030 296341737 806184542 806184542 806184542 989331127 296341737 806184542 989331127 296341737 806184542 989331127 296341737 806184542 989331127 296341737 806184542 806184542 989331127 296341737 296341737 296341737 806184542 9893...

output:

339

result:

ok single line: '339'

Test #22:

score: 8
Accepted
time: 34ms
memory: 7944kb

input:

1
500
361183277 863317163 788070566 361183277 361183277 863317163 788070566 361183277 632739493 788070566 788070566 361183277 863317163 788070566 361183277 863317163 788070566 361183277 863317163 788070566 361183277 863317163 788070566 361183277 863317163 788070566 361183277 863317163 788070566 3611...

output:

353

result:

ok single line: '353'

Test #23:

score: 8
Accepted
time: 35ms
memory: 7820kb

input:

1
500
360892412 146618517 575516781 360892412 146618517 575516781 360892412 146618517 575516781 360892412 146618517 575516781 360892412 146618517 575516781 360892412 146618517 575516781 360892412 146618517 575516781 360892412 146618517 575516781 360892412 146618517 575516781 360892412 146618517 5755...

output:

423

result:

ok single line: '423'

Test #24:

score: 8
Accepted
time: 31ms
memory: 7816kb

input:

3
68
975239020 470667175 323925950 975239020 470667175 323925950 975239020 470667175 323925950 975239020 470667175 323925950 975239020 470667175 323925950 975239020 470667175 323925950 323925950 323925950 975239020 470667175 323925950 975239020 470667175 323925950 323925950 975239020 470667175 32392...

output:

48
386
3

result:

ok 3 lines

Test #25:

score: 8
Accepted
time: 35ms
memory: 7820kb

input:

3
118
150373656 793064947 635264518 635264518 709296672 793064947 635264518 709296672 709296672 709296672 793064947 635264518 709296672 793064947 635264518 709296672 793064947 793064947 635264518 709296672 793064947 793064947 635264518 709296672 793064947 635264518 709296672 793064947 635264518 7092...

output:

97
230
33

result:

ok 3 lines

Test #26:

score: 8
Accepted
time: 35ms
memory: 7820kb

input:

3
113
89789132 548906728 545868627 545868627 89789132 548906728 545868627 89789132 548906728 545868627 89789132 548906728 545868627 89789132 548906728 545868627 89789132 548906728 545868627 89789132 548906728 545868627 89789132 548906728 545868627 89789132 548906728 545868627 89789132 548906728 5458...

output:

101
127
137

result:

ok 3 lines

Test #27:

score: 8
Accepted
time: 35ms
memory: 7828kb

input:

3
108
794907019 802850140 730657927 730657927 794907019 794907019 802850140 730657927 794907019 802850140 730657927 794907019 794907019 802850140 802850140 730657927 794907019 802850140 730657927 730657927 794907019 802850140 802850140 802850140 802850140 730657927 794907019 802850140 730657927 7306...

output:

78
71
236

result:

ok 3 lines

Test #28:

score: 8
Accepted
time: 35ms
memory: 7748kb

input:

3
55
382906854 86510837 1801762 382906854 86510837 1801762 382906854 382906854 578362690 1801762 382906854 86510837 1801762 382906854 86510837 1801762 1801762 382906854 86510837 1801762 382906854 86510837 1801762 382906854 86510837 1801762 382906854 86510837 382906854 1801762 86510837 382906854 1801...

output:

43
81
289

result:

ok 3 lines

Test #29:

score: 8
Accepted
time: 37ms
memory: 7936kb

input:

20
38
68789463 462582466 279061055 68789463 536943437 279061055 68789463 536943437 279061055 68789463 536943437 279061055 68789463 536943437 279061055 68789463 536943437 279061055 68789463 536943437 279061055 68789463 536943437 279061055 68789463 536943437 279061055 536943437 68789463 279061055 5369...

output:

32
18
20
76
24
7
5
9
5
42
34
25
14
4
10
29
8
16
31
9

result:

ok 20 lines

Test #30:

score: 8
Accepted
time: 47ms
memory: 7748kb

input:

100
8
594931073 674884200 594931073 960542002 674884200 594931073 404937349 674884200
3
28762160 795234252 28762160
6
693736695 693736695 515596726 693736695 568079150 515596726
2
508417829 600345257
4
637967683 731409954 197653780 548314174
9
493559887 493559887 995798571 234632692 493559887 995798...

output:

7
2
4
2
4
7
3
3
3
1
8
1
5
3
1
1
2
5
3
10
3
1
3
6
4
5
5
1
6
2
2
6
9
9
2
7
3
5
8
1
7
11
3
4
3
12
1
1
5
2
4
8
1
1
9
4
1
4
3
14
3
2
1
2
2
3
2
5
4
6
2
9
3
2
5
1
2
9
1
10
3
19
7
2
2
5
1
15
1
1
6
11
1
1
2
1
2
5
8
4

result:

ok 100 lines

Test #31:

score: 8
Accepted
time: 31ms
memory: 7948kb

input:

1
500
3 2 2 3 1 1 1 2 3 2 2 1 3 1 3 3 1 1 3 1 1 2 3 1 1 1 2 2 1 2 1 3 3 2 3 3 2 2 1 2 3 1 2 2 3 3 1 3 3 3 3 3 2 1 2 3 1 3 1 2 1 3 3 1 1 1 1 3 3 1 1 3 3 1 1 1 3 3 2 3 1 1 1 1 1 1 2 1 1 3 1 3 2 1 3 3 1 3 1 1 1 2 3 3 2 1 3 3 3 2 1 3 3 3 1 3 3 1 3 2 2 2 1 1 1 1 3 3 1 2 1 2 2 2 3 3 1 1 1 3 2 3 1 3 3 2 1 ...

output:

162

result:

ok single line: '162'

Test #32:

score: 8
Accepted
time: 34ms
memory: 7768kb

input:

1
500
1 1 1 2 2 1 2 3 2 1 1 3 1 1 1 3 2 3 2 2 1 2 2 3 3 1 3 3 3 2 3 2 2 3 2 3 1 3 1 1 3 2 1 3 3 1 3 2 3 1 3 1 3 2 2 1 1 3 1 2 1 1 1 3 1 2 2 2 2 3 2 3 3 2 1 1 3 2 3 3 3 2 2 2 2 1 1 3 1 1 3 1 3 1 2 1 2 3 2 2 3 1 3 1 1 1 3 3 1 3 3 2 2 1 3 3 1 1 3 1 2 3 3 2 1 2 1 3 1 1 1 2 1 3 1 1 2 1 2 3 3 2 1 3 2 3 2 ...

output:

170

result:

ok single line: '170'

Test #33:

score: 8
Accepted
time: 30ms
memory: 7744kb

input:

1
500
1 3 1 3 1 1 3 1 2 2 1 1 1 1 1 3 3 2 2 3 2 2 1 2 3 1 2 1 3 1 1 1 1 1 3 3 1 3 3 1 1 3 3 3 1 3 1 3 1 2 1 1 2 2 2 1 3 3 2 2 3 3 1 2 3 1 2 3 1 1 1 2 2 1 1 1 2 3 1 3 2 1 1 1 3 3 1 1 1 1 3 2 2 3 3 1 2 2 2 1 3 3 3 1 2 2 1 3 3 2 2 2 1 3 1 2 3 1 2 1 3 3 2 2 2 3 2 1 1 2 1 1 1 1 3 1 3 1 2 1 2 2 2 3 2 1 3 ...

output:

171

result:

ok single line: '171'

Test #34:

score: 8
Accepted
time: 35ms
memory: 7832kb

input:

3
226
2 2 2 3 3 3 3 1 2 1 2 1 3 3 3 2 2 2 1 3 3 3 2 3 3 3 2 2 2 3 3 2 1 2 3 1 3 2 2 3 3 1 2 2 3 1 2 3 1 3 2 1 3 1 2 3 3 3 3 1 3 2 1 3 3 1 1 2 1 3 1 3 1 3 2 2 2 2 1 2 2 2 2 1 2 1 1 3 1 2 2 2 1 2 3 3 1 1 3 3 1 1 2 1 3 3 3 2 3 3 1 3 2 1 2 1 2 3 1 3 3 2 2 2 3 3 3 2 2 3 2 2 1 1 2 2 3 2 2 2 2 3 2 1 2 2 3 ...

output:

81
106
57

result:

ok 3 lines

Test #35:

score: 8
Accepted
time: 37ms
memory: 7796kb

input:

20
23
3 2 3 2 2 1 3 3 1 2 3 1 2 2 2 1 2 1 3 1 1 2 1
19
2 2 3 3 1 2 2 2 3 1 2 3 3 3 1 1 1 2 1
12
2 3 3 2 3 1 3 1 3 2 2 1
39
1 2 1 1 2 2 2 1 2 2 2 1 1 1 3 2 3 1 1 2 1 3 2 2 3 2 2 2 3 1 2 1 3 1 2 1 1 2 1
21
2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2
24
1 2 3 1 1 1 2 3 1 2 3 2 1 3 3 2 1 3 2 1 3 2 1 3
15
...

output:

10
10
6
11
1
17
6
35
4
2
5
4
3
19
79
22
2
2
5
22

result:

ok 20 lines

Test #36:

score: 8
Accepted
time: 44ms
memory: 7756kb

input:

100
2
1 2
2
1 3
4
2 3 1 2
3
1 1 2
1
3
3
1 2 2
1
3
6
1 2 1 1 3 2
2
3 3
3
3 3 1
5
3 1 3 3 1
1
1
4
3 1 3 3
15
2 3 2 3 2 3 1 3 1 2 2 1 1 1 2
2
3 2
4
2 3 3 3
6
2 2 2 2 1 3
15
1 3 2 1 3 3 1 1 3 3 3 1 2 1 2
4
1 2 3 3
3
2 1 1
9
3 3 3 1 1 2 3 2 1
4
1 1 1 3
11
2 2 3 1 3 2 2 2 2 2 2
5
1 2 1 3 2
4
3 1 3 3
9
3 2...

output:

2
2
4
2
1
2
1
4
1
2
2
1
2
6
2
2
3
7
3
2
5
2
4
4
2
5
4
2
6
5
2
5
2
2
5
5
3
7
6
2
3
2
2
2
1
2
5
2
3
5
2
3
5
7
4
2
2
1
1
15
3
2
3
1
3
1
5
3
2
4
1
2
6
2
5
1
2
4
1
1
1
2
7
2
3
6
1
3
2
4
5
1
2
3
5
1
3
4
2
3

result:

ok 100 lines

Test #37:

score: 8
Accepted
time: 280ms
memory: 7772kb

input:

1
500
455886399 626955833 421163133 892575355 805049331 975659748 741071093 875911704 113500223 113500223 661192282 597935861 597935861 262970158 495955172 153851712 234849549 887929988 887929988 887929988 887929988 542128740 727090845 727090845 685055701 224058754 37318791 519705695 83375459 722649...

output:

469

result:

ok single line: '469'

Test #38:

score: 8
Accepted
time: 289ms
memory: 7888kb

input:

1
500
29435243 925769090 446792611 21667712 789719595 410464435 789287785 96845859 690771702 190228530 64528308 200770249 815748901 521046227 312297467 316401902 401409002 745745759 124319941 371122503 512242376 34813204 305249842 744963641 43370519 348889633 348889633 47719027 937000032 168595842 1...

output:

477

result:

ok single line: '477'

Test #39:

score: 8
Accepted
time: 289ms
memory: 7768kb

input:

1
500
602984088 664773836 177454793 1016966 334198372 285460610 132471773 172555823 678108588 569521673 975831156 698378851 695351143 743016550 389745384 304682329 700880753 700880753 914143778 268616886 223218955 837422858 549920713 672348418 767277498 618713431 61983854 68335376 960714345 60895712...

output:

477

result:

ok single line: '477'

Test #40:

score: 8
Accepted
time: 35ms
memory: 7832kb

input:

1
500
271946887 695308006 271946887 271946887 294535481 695308006 294535481 271946887 271946887 294535481 271946887 695308006 294535481 294535481 271946887 294535481 271946887 695308006 271946887 695308006 294535481 695308006 294535481 271946887 294535481 695308006 294535481 695308006 271946887 6953...

output:

241

result:

ok single line: '241'

Test #41:

score: 8
Accepted
time: 34ms
memory: 7764kb

input:

1
500
720937483 17827429 720937483 971419328 720937483 17827429 971419328 720937483 17827429 720937483 971419328 17827429 720937483 971419328 17827429 971419328 17827429 971419328 720937483 971419328 17827429 720937483 17827429 720937483 971419328 720937483 971419328 720937483 17827429 971419328 178...

output:

232

result:

ok single line: '232'

Test #42:

score: 8
Accepted
time: 34ms
memory: 7768kb

input:

1
500
45706846 591376273 45706846 591376273 45706846 591376273 186758449 45706846 591376273 45706846 591376273 186758449 591376273 186758449 591376273 45706846 186758449 591376273 45706846 186758449 591376273 591376273 186758449 591376273 45706846 591376273 186758449 591376273 186758449 45706846 591...

output:

253

result:

ok single line: '253'

Test #43:

score: 8
Accepted
time: 34ms
memory: 7876kb

input:

1
500
282927666 282927666 484147677 484147677 282927666 484147677 282927666 484147677 282927666 484147677 484147677 282927666 484147677 282927666 484147677 282927666 484147677 282927666 484147677 282927666 484147677 282927666 484147677 484147677 282927666 282927666 484147677 282927666 484147677 2829...

output:

49

result:

ok single line: '49'

Test #44:

score: 8
Accepted
time: 31ms
memory: 7760kb

input:

1
500
151443807 223152423 151443807 223152423 151443807 223152423 151443807 223152423 223152423 151443807 223152423 151443807 223152423 151443807 223152423 151443807 223152423 151443807 223152423 151443807 223152423 151443807 223152423 151443807 223152423 151443807 223152423 151443807 223152423 1514...

output:

14

result:

ok single line: '14'

Test #45:

score: 8
Accepted
time: 31ms
memory: 7856kb

input:

1
500
579768459 816932976 579768459 816932976 579768459 816932976 579768459 579768459 816932976 579768459 327660977 579768459 327660977 327660977 579768459 327660977 579768459 327660977 579768459 327660977 579768459 327660977 579768459 327660977 579768459 327660977 579768459 327660977 327660977 5797...

output:

28

result:

ok single line: '28'

Test #46:

score: 8
Accepted
time: 46ms
memory: 7816kb

input:

1
500
414505640 887314173 414505640 205268028 414505640 887314173 414505640 827649339 887314173 827649339 348309219 827649339 887314173 827649339 348309219 827649339 887314173 827649339 348309219 827649339 887314173 827649339 144164301 887314173 144164301 155363834 144164301 887314173 144164301 7702...

output:

346

result:

ok single line: '346'

Test #47:

score: 8
Accepted
time: 53ms
memory: 7800kb

input:

1
500
671728328 441054685 671728328 645366031 671728328 441054685 671728328 803083316 441054685 803083316 490509277 803083316 441054685 803083316 252342793 441054685 252342793 304397499 252342793 441054685 252342793 211149108 441054685 211149108 83472025 211149108 441054685 211149108 969490582 44105...

output:

331

result:

ok single line: '331'

Test #48:

score: 8
Accepted
time: 38ms
memory: 7760kb

input:

1
500
10771846 877966861 10771846 737001418 10771846 877966861 10771846 737001418 10771846 877966861 10771846 737001418 10771846 877966861 10771846 737001418 10771846 877966861 10771846 737001418 10771846 877966861 10771846 737001418 10771846 877966861 10771846 762757376 877966861 762757376 38921535...

output:

359

result:

ok single line: '359'

Test #49:

score: 8
Accepted
time: 35ms
memory: 7764kb

input:

1
500
259712038 76498306 76498306 259712038 76498306 259712038 76498306 259712038 76498306 259712038 76498306 259712038 76498306 415413414 76498306 415413414 953033042 415413414 953033042 415413414 415413414 953033042 953033042 415413414 953033042 415413414 953033042 415413414 953033042 742889991 74...

output:

61

result:

ok single line: '61'

Test #50:

score: 8
Accepted
time: 37ms
memory: 7768kb

input:

1
500
833260882 375311563 833260882 375311563 833260882 375311563 833260882 375311563 375311563 833260882 833260882 375311563 833260882 375311563 833260882 375311563 833260882 375311563 375311563 833260882 375311563 433607285 375311563 433607285 375311563 433607285 375311563 267102281 375311563 6556...

output:

76

result:

ok single line: '76'

Test #51:

score: 8
Accepted
time: 36ms
memory: 7832kb

input:

1
500
701777023 114316309 701777023 114316309 701777023 114316309 701777023 114316309 701777023 114316309 701777023 701777023 114316309 4578253 114316309 4578253 114316309 114316309 4578253 114316309 4578253 114316309 4578253 114316309 4578253 114316309 4578253 114316309 4578253 114316309 4578253 11...

output:

72

result:

ok single line: '72'

Test #52:

score: 8
Accepted
time: 32ms
memory: 7764kb

input:

1
500
25469206 25469206 212543486 25469206 212543486 25469206 212543486 115107578 212543486 115107578 212543486 115107578 212543486 115107578 115107578 212543486 115107578 212543486 421158058 421158058 212543486 421158058 212543486 421158058 421158058 212543486 421158058 212543486 212543486 42115805...

output:

61

result:

ok single line: '61'

Test #53:

score: 8
Accepted
time: 37ms
memory: 7832kb

input:

1
500
682522770 508839869 682522770 508839869 682522770 508839869 165553515 508839869 165553515 508839869 810406081 508839869 810406081 508839869 165227240 508839869 165227240 508839869 165227240 508839869 165227240 508839869 165227240 508839869 165227240 508839869 165227240 508839869 165227240 5088...

output:

272

result:

ok single line: '272'

Test #54:

score: 8
Accepted
time: 33ms
memory: 7824kb

input:

1
500
409411658 340511656 409411658 340511656 409411658 340511656 409411658 340511656 806492284 885501368 806492284 885501368 806492284 885501368 806492284 885501368 806492284 885501368 806492284 885501368 806492284 885501368 806492284 885501368 806492284 885501368 806492284 885501368 806492284 8855...

output:

124

result:

ok single line: '124'

Test #55:

score: 8
Accepted
time: 35ms
memory: 7808kb

input:

3
94
1 4 3 5 3 4 3 1 7 3 4 1 5 6 4 1 7 6 3 7 5 1 7 6 2 6 5 6 7 5 3 4 7 4 7 4 6 7 2 1 2 2 5 5 1 4 1 6 2 3 1 2 7 4 2 1 2 1 4 7 1 6 2 1 4 3 4 2 3 7 2 7 2 4 1 4 7 1 3 4 6 1 7 1 5 2 5 7 3 7 4 6 2 1
52
1 6 7 7 5 1 7 3 7 3 5 6 7 7 3 6 4 1 6 4 2 2 4 6 5 5 5 6 2 7 5 2 3 1 1 1 3 7 6 4 6 3 2 5 5 7 4 3 7 2 4 2
...

output:

76
37
294

result:

ok 3 lines

Test #56:

score: 8
Accepted
time: 35ms
memory: 7760kb

input:

3
50
1 1 7 5 5 2 7 5 2 7 2 7 5 7 5 3 7 3 3 5 7 5 7 3 7 5 7 3 7 5 7 3 7 3 5 3 5 3 1 1 7 1 1 1 7 3 3 1 7 3
94
7 6 6 7 5 7 6 7 5 5 6 5 7 6 5 6 5 6 5 6 5 6 7 6 7 6 7 6 7 5 7 6 7 5 7 6 7 5 7 5 7 5 6 7 6 5 7 6 5 7 6 6 5 6 5 5 6 7 5 7 6 7 5 6 7 5 6 5 6 7 5 6 5 6 6 5 7 5 6 7 5 7 7 5 7 5 5 7 6 7 6 7 7 6
356
...

output:

28
44
179

result:

ok 3 lines

Test #57:

score: 8
Accepted
time: 35ms
memory: 7744kb

input:

3
139
6 5 6 5 6 5 6 5 5 6 5 6 5 6 5 6 5 6 5 6 6 5 6 5 6 5 6 5 6 5 6 7 6 5 7 5 7 5 7 5 7 5 7 7 5 7 5 7 5 7 5 7 5 7 5 7 7 5 7 7 5 7 5 7 5 7 5 5 7 5 5 5 7 5 7 5 7 5 7 7 5 7 7 5 7 5 7 5 7 5 7 5 5 7 5 7 5 7 5 7 5 7 5 7 5 7 5 7 5 7 5 5 7 5 7 5 7 7 5 7 5 7 5 7 5 7 5 7 5 7 5 5 7 5 7 5 7 5 7
313
1 5 1 5 1 5 ...

output:

6
8
7

result:

ok 3 lines

Test #58:

score: 8
Accepted
time: 31ms
memory: 7828kb

input:

3
190
3 5 3 1 3 5 3 1 3 5 3 1 3 5 3 1 3 5 3 1 3 5 3 1 3 5 3 2 5 2 7 2 5 2 7 2 5 2 7 2 5 2 7 2 5 2 3 5 3 1 3 5 3 1 3 5 3 1 3 5 3 1 3 5 3 1 3 5 3 1 3 5 3 1 3 5 3 2 5 2 7 2 5 2 7 2 5 2 7 2 5 2 4 5 4 6 4 5 4 6 4 5 4 6 4 5 4 6 4 5 4 6 4 5 4 6 4 5 4 6 4 5 4 6 4 5 4 6 4 5 4 6 4 5 4 6 4 5 4 6 4 5 4 6 4 5 4 ...

output:

139
118
101

result:

ok 3 lines

Test #59:

score: 8
Accepted
time: 31ms
memory: 7832kb

input:

3
130
3 2 3 2 3 5 3 5 3 5 3 5 3 5 3 5 3 5 3 5 3 5 3 5 3 5 2 5 2 5 2 5 1 5 1 5 1 5 1 5 2 5 2 5 2 5 2 5 2 5 2 5 2 5 2 5 2 5 2 5 2 6 2 6 2 6 2 6 2 6 2 6 2 2 1 2 1 2 1 2 1 4 1 4 1 4 1 4 1 4 6 4 6 4 6 4 6 5 6 5 6 5 6 5 2 5 2 5 2 5 2 5 2 5 2 5 2 5 2 5 2 5 2 5 2 5 2 5 2 5
74
4 6 6 6 4 6 4 6 4 6 6 4 6 4 4 6...

output:

20
9
51

result:

ok 3 lines

Test #60:

score: 8
Accepted
time: 31ms
memory: 7828kb

input:

3
107
6 7 6 2 6 7 6 2 6 7 6 2 6 7 6 2 6 7 6 2 6 7 6 4 7 4 3 4 7 4 1 7 1 5 1 7 1 5 1 7 1 4 7 4 6 4 7 4 7 3 5 3 4 3 4 3 4 3 4 3 4 3 4 3 4 3 4 3 4 3 4 4 3 4 3 4 3 4 3 4 5 7 5 7 7 3 7 5 7 5 3 5 7 3 5 7 6 1 1 6 7 1 6 1 7 6 1
73
2 3 2 6 2 2 1 2 1 2 1 2 1 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 2 1 6 7 5 6...

output:

57
17
92

result:

ok 3 lines

Test #61:

score: 8
Accepted
time: 55ms
memory: 7760kb

input:

3
146
905971758 240705216 290005132 536589372 460138502 563090429 725778480 26169743 637578914 392036242 235133216 533603958 883176441 883176441 42792325 656076467 933696550 673478376 835737951 748712810 194445723 891601325 555381933 985608038 597901844 939157103 718305152 566848749 594357652 652864...

output:

140
178
158

result:

ok 3 lines

Test #62:

score: 8
Accepted
time: 31ms
memory: 7812kb

input:

3
49
74830278 539516613 74830278 539516613 784024584 74830278 784024584 74830278 784024584 74830278 784024584 539516613 784024584 539516613 784024584 539516613 74830278 539516613 784024584 74830278 784024584 539516613 784024584 539516613 784024584 539516613 784024584 539516613 74830278 784024584 748...

output:

20
143
98

result:

ok 3 lines

Test #63:

score: 8
Accepted
time: 31ms
memory: 7836kb

input:

3
320
662263417 662263417 759212235 662263417 759212235 759212235 662263417 759212235 662263417 759212235 662263417 759212235 662263417 759212235 662263417 759212235 662263417 759212235 662263417 759212235 662263417 759212235 757302985 757302985 662263417 759212235 757302985 662263417 757302985 7573...

output:

42
9
6

result:

ok 3 lines

Test #64:

score: 8
Accepted
time: 39ms
memory: 7824kb

input:

3
66
635958303 572691027 635958303 753983766 635958303 572691027 635958303 753983766 635958303 572691027 635958303 910469217 572691027 910469217 459355619 910469217 572691027 910469217 965777089 572691027 965777089 888016580 965777089 572691027 965777089 888016580 965777089 572691027 965777089 88801...

output:

47
199
90

result:

ok 3 lines

Test #65:

score: 8
Accepted
time: 31ms
memory: 7768kb

input:

3
365
563779268 572686550 746125689 572686550 746125689 572686550 746125689 572686550 746125689 572686550 746125689 572686550 746125689 746125689 572686550 746125689 572686550 84079729 84079729 572686550 84079729 572686550 84079729 406080738 84079729 406080738 84079729 406080738 84079729 406080738 4...

output:

56
12
9

result:

ok 3 lines

Test #66:

score: 8
Accepted
time: 34ms
memory: 7748kb

input:

3
361
595120737 491102101 595120737 491102101 595120737 832860755 595120737 832860755 595120737 832860755 736132025 832860755 832860755 736132025 832860755 736132025 736132025 832860755 736132025 4935212 96717202 336300849 96717202 336300849 501484470 336300849 501484470 336300849 501484470 78987245...

output:

147
4
66

result:

ok 3 lines

Test #67:

score: 8
Accepted
time: 45ms
memory: 7740kb

input:

10
61
26262500 240243187 237605778 28465702 102474829 431061606 310285858 101698003 596018567 698370876 852860590 318488204 489778201 843922819 706993266 409247144 444122524 785662333 54507781 220155124 463482685 415924514 967953100 443774257 534915647 760684187 312341892 294928021 958814839 4706823...

output:

60
5
7
6
47
5
11
33
131
155

result:

ok 10 lines

Test #68:

score: 8
Accepted
time: 36ms
memory: 7760kb

input:

10
6
700522940 296770226 700522940 700522940 738757773 700522940
13
180402080 105717690 979369373 180402080 979369373 105717690 180402080 979369373 105717690 374355075 656232386 656232386 374355075
67
697908824 792580337 697908824 542154874 792580337 697908824 792580337 697908824 235065059 697908824...

output:

4
9
37
24
10
63
83
19
13
10

result:

ok 10 lines

Test #69:

score: 8
Accepted
time: 36ms
memory: 7740kb

input:

10
56
934591892 58329970 934591892 58329970 934591892 58329970 934591892 58329970 934591892 58329970 934591892 58329970 934591892 58329970 52828378 58329970 934591892 52828378 794728475 934591892 52828378 934591892 794728475 52828378 794728475 934591892 52828378 794728475 934591892 52828378 79472847...

output:

23
2
4
11
5
5
5
13
2
2

result:

ok 10 lines

Test #70:

score: 8
Accepted
time: 36ms
memory: 7868kb

input:

10
36
107463914 913609990 107463914 368438061 107463914 913609990 107463914 368438061 107463914 913609990 107463914 511278029 414697574 511278029 575972110 511278029 414697574 511278029 33707345 414697574 33707345 889876537 33707345 414697574 33707345 889876537 33707345 414697574 33707345 285018984 ...

output:

26
50
85
43
15
3
48
4
35
45

result:

ok 10 lines

Test #71:

score: 8
Accepted
time: 36ms
memory: 7936kb

input:

10
18
283112771 436225265 283112771 436225265 283112771 436225265 283112771 436225265 283112771 436225265 283112771 436225265 283112771 436225265 283112771 591466704 283112771 591466704
1
861163789
28
349333071 926730064 349333071 926730064 86207441 926730064 86207441 926730064 86207441 926730064 86...

output:

4
1
7
2
16
2
2
24
2
20

result:

ok 10 lines

Test #72:

score: 8
Accepted
time: 32ms
memory: 7872kb

input:

10
40
583660420 128778708 583660420 418338271 797588694 418338271 418338271 36416458 797588694 418338271 36416458 418338271 609195672 547273127 88921181 915282122 252885739 915282122 915282122 252885739 915282122 252885739 915282122 845921357 315576577 845921357 74770157 79216870 866919853 129145613...

output:

25
30
46
15
3
12
39
11
14
17

result:

ok 10 lines

Test #73:

score: 8
Accepted
time: 48ms
memory: 7936kb

input:

100
1
13230502
6
613065989 209589809 209589809 27485586 951264264 410243397
11
712826200 128754523 499514641 619949545 304091114 595574683 898865435 521720060 115391977 409473053 10001963
11
843849239 576984692 99319972 428828222 290932762 98181009 890551489 185106247 116388923 376464259 964668849
1...

output:

1
5
11
11
10
7
2
3
8
1
1
5
2
2
1
1
5
3
6
2
6
2
4
4
5
9
7
3
1
13
5
6
4
2
1
1
2
3
1
3
1
3
2
3
8
10
3
2
4
4
4
2
2
7
2
1
8
3
2
1
6
11
3
2
6
3
2
5
2
8
1
2
5
20
10
5
5
1
8
13
7
1
10
4
9
2
5
13
7
16
6
3
8
2
4
1
6
2
1
5

result:

ok 100 lines

Test #74:

score: 8
Accepted
time: 48ms
memory: 7812kb

input:

100
2
800872870 982239765
24
59122782 536038598 59122782 59122782 268124857 247528547 59122782 247528547 268124857 59122782 268124857 268124857 210119477 247528547 268124857 247528547 268124857 268124857 268124857 210119477 247528547 210119477 247528547 268124857
3
924271158 328390958 670114185
4
69...

output:

2
13
3
3
6
5
4
1
2
2
2
4
1
2
2
6
3
1
2
1
3
4
1
2
4
2
2
2
2
2
1
7
2
2
1
3
8
4
5
5
4
8
10
17
3
4
4
2
4
4
3
3
3
2
1
1
1
6
4
1
1
6
6
5
9
8
2
1
2
3
2
2
2
2
2
2
6
3
6
2
4
2
2
1
5
1
6
2
2
1
1
4
2
4
2
2
3
2
3
5

result:

ok 100 lines

Test #75:

score: 8
Accepted
time: 44ms
memory: 7824kb

input:

100
4
783340795 310809792 783340795 310809792
5
119722408 47065596 119722408 47065596 119722408
3
880830920 535205516 880830920
1
248474769
14
653960744 455546860 653960744 455546860 653960744 455546860 653960744 653960744 455546860 653960744 455546860 653960744 653960744 455546860
2
103385893 71602...

output:

2
2
2
1
2
2
2
2
2
2
2
2
4
1
2
2
2
4
2
2
2
1
1
2
1
2
2
2
2
2
2
2
2
2
2
1
1
2
2
2
2
4
2
1
2
2
2
5
2
2
5
2
2
2
2
2
2
2
2
1
2
2
2
1
2
2
1
2
2
2
2
1
2
3
2
2
1
5
2
2
2
2
2
1
2
1
2
2
2
2
2
2
2
2
2
2
2
2
2
2

result:

ok 100 lines

Test #76:

score: 8
Accepted
time: 43ms
memory: 7940kb

input:

100
8
653040023 272349230 566423990 821901787 977088214 977088214 585105781 182463393
2
138672826 237919522
2
478558926 312699166
6
472471053 194597476 739853989 739853989 466984027 544388286
4
96354375 968990285 741582104 786470599
3
582931827 597819817 951992025
6
300035070 757113713 712710617 601...

output:

7
2
2
5
4
3
5
2
6
2
2
2
4
6
4
2
4
5
2
3
1
7
10
7
3
1
5
4
2
4
6
5
2
1
1
5
3
16
3
3
15
4
3
6
12
1
4
3
6
1
1
1
1
1
3
1
3
7
5
1
14
14
5
14
8
5
11
3
4
12
13
3
1
2
6
1
10
6
6
4
8
8
7
5
5
2
3
2
3
4
1
5
3
1
4
4
4
4
1
3

result:

ok 100 lines

Test #77:

score: 8
Accepted
time: 44ms
memory: 7704kb

input:

100
1
653986630
7
78293455 81369374 78293455 140941205 78293455 78293455 140941205
1
353165852
8
217304646 79414 217304646 79414 217304646 79414 217304646 312122830
3
230131296 814455042 230131296
3
278976992 410137720 278976992
9
456114454 655155254 456114454 655155254 220030737 655155254 220030737...

output:

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

result:

ok 100 lines

Test #78:

score: 8
Accepted
time: 47ms
memory: 7808kb

input:

100
5
887163735 579534916 530441529 430846330 923345818
1
810929256
6
890875426 890875426 657094919 890875426 657094919 890875426
6
546280728 232809358 687997147 232809358 687997147 232809358
8
763532350 892527595 787186795 539587226 963903850 175053045 692102911 159230362
3
116924919 841116202 7753...

output:

5
1
2
3
8
3
3
6
2
5
5
1
3
1
1
1
7
1
3
2
1
5
5
2
6
2
2
2
9
1
15
2
1
2
8
1
1
1
4
1
7
8
5
2
3
3
6
1
3
5
3
5
2
8
4
7
11
13
4
2
5
6
6
3
3
1
3
4
12
5
2
1
3
1
2
2
3
1
5
5
2
6
11
4
9
2
5
5
2
3
5
2
2
2
11
2
10
6
1
5

result:

ok 100 lines

Subtask #4:

score: 0
Wrong Answer

Test #79:

score: 0
Wrong Answer
time: 0ms
memory: 7816kb

input:

1
200000
1 3 3 2 2 3 3 1 2 3 1 1 3 3 3 2 1 1 2 3 2 1 3 3 3 1 2 2 1 3 1 2 1 2 3 2 3 3 2 2 3 2 3 2 3 1 1 1 1 1 3 1 3 2 3 3 3 3 1 3 2 1 3 2 3 2 3 1 1 1 1 3 3 2 3 2 1 2 2 3 2 3 2 2 2 2 2 2 3 2 1 2 2 1 1 3 2 1 2 1 1 3 3 3 2 1 2 2 2 1 3 3 2 3 2 1 3 3 2 2 1 3 1 3 2 1 2 3 2 1 2 3 2 2 3 2 1 2 1 1 1 1 1 1 1 3...

output:

2

result:

wrong answer 1st lines differ - expected: '66691', found: '2'

Subtask #5:

score: 0
Skipped

Dependency #4:

0%

Subtask #6:

score: 0
Runtime Error

Dependency #3:

100%
Accepted

Test #194:

score: 0
Runtime Error

input:

3
2446
75658187 571962292 710943961 75658187 571962292 710943961 75658187 571962292 710943961 75658187 571962292 710943961 75658187 571962292 710943961 75658187 75658187 571962292 710943961 75658187 571962292 710943961 75658187 571962292 710943961 75658187 571962292 710943961 75658187 571962292 7109...

output:


result:


Subtask #7:

score: 0
Skipped

Dependency #1:

0%