QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#864552#7320. Prime TreeC1942huangjiaxuAC ✓490ms79488kbC++14879b2025-01-20 18:40:342025-01-20 18:40:35

Judging History

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

  • [2025-01-20 18:40:35]
  • 评测
  • 测评结果:AC
  • 用时:490ms
  • 内存:79488kb
  • [2025-01-20 18:40:34]
  • 提交

answer

#include<bits/stdc++.h>
using namespace std;
const int N=1e6+5;
typedef unsigned long long ull;
mt19937_64 rnd(0x66ccff);
ull Rnd(ull x){
	x^=x<<13;
	x^=x>>7;
	x^=x<<17;
	return x;
}
int n,a[N],sz[N],ans;
ull f[N],V,va[N];
vector<int>e[N];
bool check(int y){
	for(int x=n;x;--x)if(sz[x]>=y){
		if(sz[x]==y){
			if(f[x]!=va[y])return false;
		}
		ull o=V;
		for(auto v:e[x])if(sz[v]<y)o+=Rnd(f[v]);
		if(o!=va[y])return false;
	}
	return true;
}
void solve(){
	V=rnd(),ans=1;
	for(int i=1;i<=n;++i)e[i].clear();
	for(int i=2,x;i<=n;++i){
		scanf("%d",&x);
		e[x].push_back(i);
	}
	for(int x=n;x;--x){
		sz[x]=1,f[x]=V;
		for(auto v:e[x]){
			sz[x]+=sz[v];
			f[x]+=Rnd(f[v]);
		}
		va[sz[x]]=f[x];
	}
	for(int i=2;i<n;++i)if(n%i==0)if(check(i))++ans;
	printf("%d\n",ans);
}
int main(){
	while(scanf("%d",&n)!=EOF)solve();
	return 0;
}

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

Details

Tip: Click on the bar to expand more detailed information

Test #1:

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

input:

12
1 1 1 1 2 2 4 5 5 6 10
3
1 1
6
1 1 1 2 3
13
1 1 1 2 2 3 3 4 5 6 7 8

output:

3
1
2
1

result:

ok 4 lines

Test #2:

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

input:

168
1 2 3 3 2 1 1 8 9 10 10 9 8 1 15 16 17 17 16 15 15 22 23 24 24 23 22 1 29 30 31 31 30 29 29 36 37 38 38 37 36 29 43 44 45 45 44 43 43 50 51 52 52 51 50 29 57 58 59 59 58 57 57 64 65 66 66 65 64 57 71 72 73 73 72 71 71 78 79 80 80 79 78 1 85 86 87 87 86 85 85 92 93 94 94 93 92 85 99 100 101 101 1...

output:

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

result:

ok 1960 lines

Test #3:

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

input:

100
1 1 1 1 1 6 6 6 6 1 11 11 11 11 11 16 16 16 16 11 21 21 21 21 21 26 26 26 26 21 31 31 31 31 31 36 36 36 36 21 41 41 41 41 41 46 46 46 46 1 51 51 51 51 51 56 56 56 56 51 61 61 61 61 61 66 66 66 66 61 71 71 71 71 71 76 76 76 76 71 81 81 81 81 81 86 86 86 86 71 91 91 91 91 91 96 96 96 96
100
1 1 3 ...

output:

4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
...

result:

ok 10000 lines

Test #4:

score: 0
Accepted
time: 58ms
memory: 33472kb

input:

36
1 1 3 1 5 5 7 1 9 9 11 1 13 13 15 13 17 17 19 13 21 21 23 1 25 25 27 25 29 29 31 25 33 33 35
36
1 2 1 4 5 1 7 8 7 10 11 1 13 14 13 16 17 1 19 20 19 22 23 19 25 26 25 28 29 19 31 32 31 34 35
36
1 1 3 1 5 5 7 1 9 9 11 1 13 13 15 13 17 17 19 13 21 21 23 1 25 25 27 25 29 29 31 25 33 33 35
36
1 1 3 3 ...

output:

4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
...

result:

ok 27777 lines

Test #5:

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

input:

23
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
90
1 2 1 4 5 1 7 8 1 10 11 10 13 14 10 16 17 1 19 20 19 22 23 19 25 26 1 28 29 28 31 32 28 34 35 1 37 38 37 40 41 37 43 44 1 46 47 46 49 50 46 52 53 46 55 56 55 58 59 55 61 62 46 64 65 64 67 68 64 70 71 46 73 74 73 76 77 73 79 80 46 82 83 82 85 86 82 88...

output:

1
4
1
4
1
3
3
1
2
2
2
1
4
2
3
4
4
6
3
1
3
2
4
3
5
1
1
1
3
1
1
2
2
4
3
3
1
4
2
3
1
5
1
1
3
2
2
1
1
2
1
3
3
3
4
1
2
3
2
3
2
1
2
2
1
5
1
2
2
1
1
2
5
2
4
2
2
2
1
2
1
3
2
1
4
1
4
2
2
2
1
3
2
3
3
3
2
3
3
3
2
2
1
1
4
2
2
2
2
2
1
3
2
4
1
1
2
3
1
2
1
3
3
4
3
1
3
2
4
6
2
2
2
2
3
4
2
3
1
5
2
5
3
4
2
2
1
1
2
1
...

result:

ok 18231 lines

Test #6:

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

input:

339
1 1 2 3 2 1 2 3 6 1 8 8 11 7 14 9 10 8 13 16 18 19 22 19 21 23 27 24 20 21 24 30 32 29 32 33 27 35 35 38 36 34 38 36 41 37 46 48 48 41 49 51 46 52 55 55 47 49 55 57 57 58 60 58 61 61 60 61 60 59 64 67 64 72 70 71 76 77 70 74 71 72 78 76 78 84 81 77 89 86 84 85 86 93 92 96 90 95 97 91 91 98 102 9...

output:

1
1
2
3
2
2
1
3
5
1
2
2
3
5
3
1
4
1
2
3
2
2
2
5
2
4
4
3
2
2
2
4
2
3
1
4
3
1
2
2
2
2
1
2
3
1
1
4
3
3
2
2
1
1
1
2
3
3
1
3
2
2
2
5
1
2
1
1
4
3
2
1
1
3
1
2
2
4
2
6
2
1
3
3
2
1
5
2
3
5
3
3
2
2
1
1
1
1
1
3
2
1
1
4
1
1
2
2
5
2
1
1
3
2
1
2
2
3
4
1
3
1
2
5
1
1
2
3
4
1
2
2
2
3
1
1
4
2
2
1
5
3
1
2
1
2
1
2
3
5
...

result:

ok 215 lines

Test #7:

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

input:

2045
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101...

output:

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

result:

ok 327 lines

Test #8:

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

input:

4418
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 48 48 48 48 48 48 48 48 48 48 48 48 48 48 48 48 48 48 48 48 48 48 48 48 48 48 48 48 48 48 48 48 48 48 48 48 48 48 48 48 48 48 48 48 48 48 1 95 95 95 95 95 95 95 95 95 95 95 95 95 95 95 95 95 95 95 95 9...

output:

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

result:

ok 326 lines

Test #9:

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

input:

46718
1 1 1 1 1 1 2 2 2 2 2 2 2 3 3 3 3 3 3 3 4 4 4 4 4 4 4 5 5 5 5 5 5 5 6 6 6 6 6 6 6 7 7 7 7 7 7 7 8 8 8 8 8 8 8 9 9 9 9 9 9 9 10 10 10 10 10 10 10 11 1 72 72 72 72 72 72 73 73 73 73 73 73 73 74 74 74 74 74 74 74 75 75 75 75 75 75 75 76 76 76 76 76 76 76 77 77 77 77 77 77 77 78 78 78 78 78 78 78 ...

output:

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

result:

ok 33 lines

Test #10:

score: 0
Accepted
time: 68ms
memory: 38104kb

input:

27154
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 10...

output:

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

result:

ok 35 lines

Test #11:

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

input:

129968
1 1 3 3 5 5 7 7 9 9 11 11 13 13 15 15 17 17 19 19 21 21 23 23 25 25 27 27 29 29 31 31 33 33 35 35 37 37 39 39 41 41 43 43 45 45 47 47 49 49 51 51 53 53 55 55 57 57 59 59 61 61 63 63 65 65 67 67 69 69 71 71 73 73 75 75 77 77 79 79 81 81 83 83 85 85 87 87 89 89 91 91 93 93 95 95 97 97 99 99 101...

output:

5
3
5
7
7
4

result:

ok 6 lines

Test #12:

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

input:

164235
1 1 1 1 1 6 6 6 6 6 11 11 11 11 11 16 16 16 16 16 21 21 21 21 21 26 26 26 26 26 31 31 31 31 31 36 36 36 36 36 41 41 41 41 41 46 46 46 46 46 51 51 51 51 51 56 56 56 56 56 61 61 61 61 61 66 66 66 66 66 71 71 71 71 71 76 76 76 76 76 81 81 81 81 81 86 86 86 86 86 91 91 91 91 91 96 96 96 96 96 101...

output:

2
2
2
3
2
2

result:

ok 6 lines

Test #13:

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

input:

999983
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1...

output:

1

result:

ok single line: '1'

Test #14:

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

input:

999983
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 1...

output:

1

result:

ok single line: '1'

Test #15:

score: 0
Accepted
time: 86ms
memory: 77032kb

input:

999993
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 1...

output:

2

result:

ok single line: '2'

Test #16:

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

input:

1000000
1 1 1 1 1 6 6 6 6 6 11 11 11 11 11 16 16 16 16 16 21 21 21 21 1 26 26 26 26 26 31 31 31 31 31 36 36 36 36 36 41 41 41 41 41 46 46 46 46 1 51 51 51 51 51 56 56 56 56 56 61 61 61 61 61 66 66 66 66 66 71 71 71 71 51 76 76 76 76 76 81 81 81 81 81 86 86 86 86 86 91 91 91 91 91 96 96 96 96 51 101 ...

output:

12

result:

ok single line: '12'

Test #17:

score: 0
Accepted
time: 107ms
memory: 69980kb

input:

1000000
1 2 3 1 5 6 7 1 9 10 11 5 13 14 15 13 17 18 19 17 21 22 23 21 25 26 27 21 29 30 31 13 33 34 35 33 37 38 39 33 41 42 43 17 45 46 47 41 49 50 51 49 53 54 55 5 57 58 59 53 61 62 63 45 65 66 67 49 69 70 71 41 73 74 75 69 77 78 79 61 81 82 83 29 85 86 87 69 89 90 91 25 93 94 95 61 97 98 99 1 101 ...

output:

5

result:

ok single line: '5'

Test #18:

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

input:

999983
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1...

output:

1

result:

ok single line: '1'

Test #19:

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

input:

999983
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1...

output:

1

result:

ok single line: '1'

Test #20:

score: 0
Accepted
time: 88ms
memory: 46032kb

input:

441440
1 1 3 1 5 3 7 3 9 1 11 11 13 11 15 13 17 13 19 1 21 21 23 21 25 23 27 23 29 21 31 31 33 31 35 33 37 33 39 1 41 41 43 41 45 43 47 43 49 41 51 51 53 51 55 53 57 53 59 21 61 61 63 61 65 63 67 63 69 61 71 71 73 71 75 73 77 73 79 61 81 81 83 81 85 83 87 83 89 81 91 91 93 91 95 93 97 93 99 41 101 1...

output:

8
8

result:

ok 2 lines

Test #21:

score: 0
Accepted
time: 78ms
memory: 49652kb

input:

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

output:

3
5

result:

ok 2 lines

Test #22:

score: 0
Accepted
time: 107ms
memory: 58776kb

input:

982800
1 1 1 4 4 1 7 7 1 10 10 10 13 13 10 16 16 1 19 19 19 22 22 19 25 25 19 28 28 28 31 31 28 34 34 19 37 37 37 40 40 37 43 43 37 46 46 46 49 49 46 52 52 37 55 55 55 58 58 55 61 61 55 64 64 64 67 67 64 70 70 55 73 73 73 76 76 73 79 79 73 82 82 82 85 85 82 88 88 73 91 91 91 94 94 91 97 97 91 100 10...

output:

9

result:

ok single line: '9'

Test #23:

score: 0
Accepted
time: 117ms
memory: 63852kb

input:

982800
1 2 2 4 1 6 7 7 9 1 11 12 12 14 11 16 17 17 19 11 21 22 22 24 21 26 27 27 29 1 31 32 32 34 31 36 37 37 39 31 41 42 42 44 41 46 47 47 49 41 51 52 52 54 51 56 57 57 59 31 61 62 62 64 61 66 67 67 69 61 71 72 72 74 71 76 77 77 79 71 81 82 82 84 81 86 87 87 89 61 91 92 92 94 91 96 97 97 99 91 101 ...

output:

11

result:

ok single line: '11'

Test #24:

score: 0
Accepted
time: 350ms
memory: 66104kb

input:

982800
1 2 3 2 3 4 5 5 4 1 9 7 8 6 11 7 8 10 16 16 13 10 17 13 23 17 19 11 22 28 9 26 28 29 29 30 14 12 33 38 6 36 36 42 33 39 42 15 31 20 26 48 15 24 48 34 19 51 22 43 59 39 30 21 57 24 34 60 47 56 61 71 59 43 35 32 54 25 60 62 81 27 37 67 70 78 25 81 70 83 76 92 75 57 82 53 67 86 88 44 80 84 93 75...

output:

1

result:

ok single line: '1'

Test #25:

score: 0
Accepted
time: 101ms
memory: 61836kb

input:

997920
1 1 3 3 5 1 7 7 9 9 11 7 13 13 15 15 17 7 19 19 21 21 23 1 25 25 27 27 29 19 31 31 33 33 35 31 37 37 39 39 41 1 43 43 45 45 47 43 49 49 51 51 53 49 55 55 57 57 59 49 61 61 63 63 65 43 67 67 69 69 71 61 73 73 75 75 77 73 79 79 81 81 83 43 85 85 87 87 89 85 91 91 93 93 95 91 97 97 99 99 101 91 ...

output:

12

result:

ok single line: '12'

Test #26:

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

input:

997920
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 1...

output:

1

result:

ok single line: '1'

Test #27:

score: 0
Accepted
time: 278ms
memory: 49092kb

input:

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

output:

1

result:

ok single line: '1'

Test #28:

score: 0
Accepted
time: 490ms
memory: 44464kb

input:

997920
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1...

output:

1

result:

ok single line: '1'

Test #29:

score: 0
Accepted
time: 182ms
memory: 66636kb

input:

990100
1 1 3 4 3 5 7 5 4 10 2 8 12 10 14 11 2 11 13 16 14 20 13 19 15 21 17 26 28 9 27 32 8 7 9 35 25 25 39 19 22 41 17 38 39 28 43 6 31 47 38 52 26 37 24 22 47 46 56 20 58 30 29 62 49 51 33 21 35 23 59 56 18 57 69 55 67 66 66 37 70 51 12 52 6 70 85 69 74 33 63 71 82 71 43 31 65 85 45 49 88 80 101 7...

output:

1

result:

ok single line: '1'

Test #30:

score: 0
Accepted
time: 208ms
memory: 65908kb

input:

1000000
1 2 2 1 5 6 7 3 8 4 4 5 9 8 11 3 6 10 15 15 12 12 18 18 23 10 19 16 16 25 27 21 11 9 31 29 32 37 32 28 37 27 40 22 7 39 46 29 22 17 21 39 38 24 48 30 54 24 59 57 48 60 58 58 13 14 56 26 33 68 34 57 62 28 74 59 19 68 62 25 54 78 38 70 77 71 86 53 66 36 61 20 72 35 55 49 20 93 13 30 79 51 63 7...

output:

1

result:

ok single line: '1'

Extra Test:

score: 0
Extra Test Passed