QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#357471#1241. RaidDiuWA 25ms108268kbC++142.8kb2024-03-18 21:37:432024-03-18 21:37:43

Judging History

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

  • [2024-03-18 21:37:43]
  • 评测
  • 测评结果:WA
  • 用时:25ms
  • 内存:108268kb
  • [2024-03-18 21:37:43]
  • 提交

answer

#include<bits/stdc++.h>
#define ll long long
using namespace std;
const int N=42,M=3.2e6;
int n,a[N],vis[N];
int b[N],m1,c[N],m2;
int p[N],q[N];
struct node{
	int x;ll y;
	node(int xx=N*N,int yy=0){x=xx,y=yy;}
}f[M],g[M];
const node empty;
int sz[M];
node operator +(node a,int b){
	return (node){a.x+b,a.y};
}
node operator +(node a,node b){
	if(a.x<b.x)return a;
	if(a.x>b.x)return b;
	return (node){a.x,a.y+b.y};
}
node operator +=(node &a,node b){
	return a=a+b;
}
signed main(){
	scanf("%d",&n);
	for(int i=1;i<=n;i++)scanf("%d",&a[i]);
	f[0]=(node){0,1};
	p[0]=1;
	for(int i=1;i<=n;i++){
//		printf("Work:%d\n",i);
		int x=0;
		if(vis[a[i]-1]&&vis[a[i]+1]){
			m2=m1-1;
			x=vis[a[i]-1];
			for(int j=1;j<x;j++)c[j]=b[j];
			c[x]=b[x]+b[x+1]+1;
			for(int j=x+1;j<=m2;j++)c[j]=b[j+1];
			q[0]=1;
			for(int j=1;j<=m2;j++)q[j]=q[j-1]*(c[j]+1);
			for(int j=1;j<=m1;j++){
				for(int s=0;s<p[j-1];s++)for(int k=1;k<=b[j];k++){
					sz[s+k*p[j-1]]=sz[s]+(j>x?k:0);
				}
			}
//			printf("Now:%d\n",x);
//			for(int j=1;j<=m1;j++)printf("%d ",p[j]);puts("");
//			for(int j=1;j<=m2;j++)printf("%d ",q[j]);puts("");
			for(int s=0;s<p[m1];s++){
				int t=s%p[x-1]+s/p[x+1]*q[x]+(s/p[x-1]%(b[x]+1)+s/p[x]%(b[x+1]+1))*q[x-1];
				g[t]+=f[s],g[t+q[x-1]]+=(f[s]+sz[s]);
//				printf("%d %d\n",s,t);
			}
			vis[a[i]]=x;
			for(int j=a[i]+1;j<=n;j++)if(vis[j])--vis[j];
		}else if(vis[a[i]-1]||vis[a[i]+1]){
			x=vis[a[i]-1]+vis[a[i]+1];
			int y=vis[a[i]-1]?x:x-1;
			m2=m1;
			for(int j=1;j<=m2;j++)c[j]=b[j];c[x]++;
			p[0]=1,q[0]=1;
			for(int j=1;j<=m1;j++)p[j]=p[j-1]*(b[j]+1);
			for(int j=1;j<=m2;j++)q[j]=q[j-1]*(c[j]+1);
			for(int j=1;j<=m1;j++){
				for(int s=0;s<p[j-1];s++)for(int k=1;k<=b[j];k++){
					sz[s+k*p[j-1]]=sz[s]+(j>y?k:0);
				}
			}
			for(int s=0;s<p[m1];s++){
				int t=s%p[x]+s/p[x]*q[x];
				g[t]+=f[s],g[t+q[x-1]]+=(f[s]+sz[s]);
			}
			vis[a[i]]=x;
		}else{
			m2=m1+1;
			int l=a[i];
			while(l&&!vis[l])--l;
			int x=vis[l]+1;
			for(int j=1;j<x;j++)c[j]=b[j];
			c[x]=1;
			for(int j=x+1;j<=m2;j++)c[j]=b[j-1];
			q[0]=1;
			for(int j=1;j<=m2;j++)q[j]=q[j-1]*(c[j]+1);
			for(int j=1;j<=m1;j++){
				for(int s=0;s<p[j-1];s++)for(int k=1;k<=b[j];k++){
					sz[s+k*p[j-1]]=sz[s]+(j>=x?k:0);
				}
			}
			for(int s=0;s<p[m1];s++){
				int t=s%p[x-1]+s/p[x-1]*q[x];
				g[t]+=f[s],g[t+q[x-1]]+=(f[s]+sz[s]);
			}
			vis[a[i]]=x;
			for(int j=a[i]+1;j<=n;j++)if(vis[j])++vis[j];
		}
		m1=m2;
		for(int j=1;j<=m1;j++)b[j]=c[j];
		for(int j=0;j<=m1;j++)p[j]=q[j];
		for(int s=0;s<p[m1];s++)f[s]=g[s],g[s]=empty;
//		for(int j=1;j<=m1;j++)printf("%d ",b[j]);puts("");
//		for(int j=1;j<=n;j++)printf("%d ",vis[j]);puts("");
//		for(int s=0;s<p[m1];s++)printf("Node:%d %d %d\n",s,f[s].x,f[s].y);
	}
	for(int i=1;i<=n;i++)printf("%d %lld\n",f[i].x,f[i].y);
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 7ms
memory: 104804kb

input:

5
5 3 1 4 2

output:

0 5
0 3
1 2
3 1
7 1

result:

ok 10 numbers

Test #2:

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

input:

1
1

output:

0 1

result:

ok 2 number(s): "0 1"

Test #3:

score: 0
Accepted
time: 7ms
memory: 103928kb

input:

2
1 2

output:

0 2
0 1

result:

ok 4 number(s): "0 2 0 1"

Test #4:

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

input:

3
2 1 3

output:

0 3
0 2
1 1

result:

ok 6 numbers

Test #5:

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

input:

4
3 1 2 4

output:

0 4
0 4
0 1
2 1

result:

ok 8 numbers

Test #6:

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

input:

5
1 2 5 4 3

output:

0 5
0 7
0 3
1 3
3 1

result:

ok 10 numbers

Test #7:

score: 0
Accepted
time: 8ms
memory: 105296kb

input:

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

output:

0 18
0 78
0 132
0 104
0 38
0 5
1 2
3 6
5 1
9 8
12 1
17 1
25 4
33 5
41 2
50 1
61 1
75 1

result:

ok 36 numbers

Test #8:

score: 0
Accepted
time: 7ms
memory: 105196kb

input:

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

output:

0 18
0 76
0 141
0 139
0 78
0 24
0 3
1 2
3 3
5 1
10 3
15 1
22 1
30 1
40 1
52 3
64 2
77 1

result:

ok 36 numbers

Test #9:

score: 0
Accepted
time: 11ms
memory: 104008kb

input:

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

output:

0 18
0 86
0 190
0 223
0 154
0 60
0 10
1 12
2 2
4 4
6 1
9 1
15 3
21 1
29 1
39 1
50 1
67 1

result:

ok 36 numbers

Test #10:

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

input:

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

output:

0 18
0 153
0 816
0 3060
0 8568
0 18564
0 31824
0 43758
0 48620
0 43758
0 31824
0 18564
0 8568
0 3060
0 816
0 153
0 18
0 1

result:

ok 36 numbers

Test #11:

score: 0
Accepted
time: 13ms
memory: 105860kb

input:

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

output:

0 18
1 153
3 816
6 3060
10 8568
15 18564
21 31824
28 43758
36 48620
45 43758
55 31824
66 18564
78 8568
91 3060
105 816
120 153
136 18
153 1

result:

ok 36 numbers

Test #12:

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

input:

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

output:

0 18
0 85
0 150
0 115
0 42
0 6
1 9
2 3
4 1
7 1
11 2
16 2
22 2
29 2
37 2
46 2
56 1
68 1

result:

ok 36 numbers

Test #13:

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

input:

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

output:

0 18
0 64
0 89
0 55
0 16
0 2
1 1
3 1
6 1
10 2
15 5
20 1
27 1
35 1
45 1
57 1
72 1
89 1

result:

ok 36 numbers

Test #14:

score: 0
Accepted
time: 7ms
memory: 104020kb

input:

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

output:

0 18
0 88
0 163
0 127
0 43
0 4
1 4
2 1
4 1
7 1
11 2
15 1
20 1
27 1
35 3
43 1
53 1
65 1

result:

ok 36 numbers

Test #15:

score: 0
Accepted
time: 7ms
memory: 104412kb

input:

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

output:

0 18
0 67
0 83
0 36
0 4
1 2
3 2
6 5
9 2
13 3
18 3
24 3
31 3
39 3
48 2
58 1
70 1
86 1

result:

ok 36 numbers

Test #16:

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

input:

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

output:

0 18
0 147
0 720
0 2355
0 5418
0 8989
0 10836
0 9420
0 5760
0 2352
0 576
0 64
1 192
2 240
3 160
4 60
5 12
6 1

result:

ok 36 numbers

Test #17:

score: 0
Accepted
time: 11ms
memory: 105848kb

input:

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

output:

0 18
0 117
0 408
0 882
0 1260
0 1218
0 792
0 333
0 82
0 9
1 8
3 7
6 6
10 5
15 4
21 3
28 2
36 1

result:

ok 36 numbers

Test #18:

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

input:

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

output:

0 18
0 45
1 240
2 210
4 504
6 210
9 240
12 45
16 20
20 1
26 2
33 1
42 2
52 1
64 2
77 1
92 2
108 1

result:

ok 36 numbers

Test #19:

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

input:

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

output:

0 18
0 59
0 92
0 71
0 26
0 5
1 4
3 3
6 2
10 1
20 8
30 24
40 32
50 16
61 36
71 3
82 2
94 1

result:

ok 36 numbers

Test #20:

score: 0
Accepted
time: 7ms
memory: 105784kb

input:

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

output:

0 18
0 62
0 108
0 97
0 36
1 83
2 80
3 40
4 10
5 1
15 8
25 22
35 28
45 17
55 4
66 3
78 2
91 1

result:

ok 36 numbers

Test #21:

score: 0
Accepted
time: 8ms
memory: 104812kb

input:

23
9 4 12 20 21 23 1 8 6 10 5 17 15 18 14 3 2 19 13 7 16 22 11

output:

0 23
0 135
0 324
0 384
0 235
0 70
0 8
1 12
2 6
3 1
6 4
9 4
12 1
17 4
22 4
27 1
36 1
46 1
57 2
69 1
85 2
101 1
118 1

result:

ok 46 numbers

Test #22:

score: 0
Accepted
time: 7ms
memory: 104600kb

input:

23
13 20 19 16 7 15 5 6 23 9 12 4 14 11 17 10 2 21 18 3 22 8 1

output:

0 23
0 105
0 204
0 237
0 171
0 75
0 19
0 2
1 1
3 2
5 1
9 1
14 1
22 2
30 1
40 2
50 1
63 3
77 4
92 3
108 1
126 1
148 1

result:

ok 46 numbers

Test #23:

score: 0
Accepted
time: 7ms
memory: 105068kb

input:

23
9 5 12 7 6 3 10 2 4 8 23 1 14 11 21 18 20 22 17 15 13 19 16

output:

0 23
0 174
0 515
0 714
0 486
0 146
0 12
1 16
2 7
3 1
5 2
8 5
11 3
15 7
19 4
24 8
29 4
35 3
42 4
49 1
57 1
67 1
79 1

result:

ok 46 numbers

Test #24:

score: 0
Accepted
time: 8ms
memory: 104904kb

input:

23
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23

output:

0 23
0 253
0 1771
0 8855
0 33649
0 100947
0 245157
0 490314
0 817190
0 1144066
0 1352078
0 1352078
0 1144066
0 817190
0 490314
0 245157
0 100947
0 33649
0 8855
0 1771
0 253
0 23
0 1

result:

ok 46 numbers

Test #25:

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

input:

23
23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1

output:

0 23
1 253
3 1771
6 8855
10 33649
15 100947
21 245157
28 490314
36 817190
45 1144066
55 1352078
66 1352078
78 1144066
91 817190
105 490314
120 245157
136 100947
153 33649
171 8855
190 1771
210 253
231 23
253 1

result:

ok 46 numbers

Test #26:

score: 0
Accepted
time: 8ms
memory: 105620kb

input:

23
5 1 7 11 14 19 23 16 4 2 8 10 13 20 22 17 15 3 9 21 18 6 12

output:

0 23
0 149
0 422
0 622
0 501
0 210
0 36
1 70
2 40
3 5
5 4
8 8
11 4
15 9
19 4
24 3
30 1
39 3
48 1
59 1
73 2
88 2
104 1

result:

ok 46 numbers

Test #27:

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

input:

23
12 18 6 21 3 9 15 23 20 16 14 7 10 4 1 19 13 22 17 8 11 5 2

output:

0 23
0 104
0 164
0 109
0 30
0 2
1 1
3 6
5 3
8 7
11 1
16 3
21 1
28 1
37 4
46 1
57 4
68 1
81 1
95 1
110 1
128 1
149 1

result:

ok 46 numbers

Test #28:

score: 0
Accepted
time: 7ms
memory: 104196kb

input:

23
6 9 17 2 10 21 3 11 19 14 4 23 7 12 18 1 13 22 5 15 20 8 16

output:

0 23
0 148
0 407
0 578
0 454
0 197
0 44
0 4
1 2
3 3
5 1
8 4
11 4
14 1
18 1
23 1
31 2
39 1
50 1
62 1
76 4
90 2
105 1

result:

ok 46 numbers

Test #29:

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

input:

23
23 15 6 19 12 2 22 14 4 10 20 1 18 13 7 17 11 3 16 9 5 21 8

output:

0 23
0 107
0 178
0 124
0 36
0 4
1 3
3 7
5 5
7 1
11 1
16 3
22 7
28 2
35 1
44 1
55 3
66 1
78 1
92 1
108 2
124 1
146 1

result:

ok 46 numbers

Test #30:

score: 0
Accepted
time: 10ms
memory: 104828kb

input:

23
23 22 20 21 19 18 16 17 15 14 12 13 11 10 9 8 6 7 5 4 2 3 1

output:

0 23
0 5
2 105
4 10
8 190
12 10
18 170
24 5
32 75
40 1
50 13
61 78
73 286
86 715
100 1287
115 1716
131 1716
148 1287
166 715
185 286
205 78
226 13
248 1

result:

ok 46 numbers

Test #31:

score: 0
Accepted
time: 13ms
memory: 104532kb

input:

23
1 13 2 14 3 15 4 16 5 17 6 18 7 19 8 20 9 21 10 22 11 23 12

output:

0 23
0 187
0 825
0 2310
0 4422
0 6006
0 5874
0 4125
0 2035
0 671
0 133
0 12
1 11
3 10
6 9
10 8
15 7
21 6
28 5
36 4
45 3
55 2
66 1

result:

ok 46 numbers

Test #32:

score: 0
Accepted
time: 7ms
memory: 105000kb

input:

23
23 21 19 17 15 13 11 9 7 5 3 1 22 20 18 16 14 12 10 8 6 4 2

output:

0 23
0 66
1 440
2 495
4 1584
6 924
9 1584
12 495
16 440
20 66
25 24
30 1
37 2
45 1
55 2
66 1
79 2
93 1
109 2
126 1
145 2
165 1
187 1

result:

ok 46 numbers

Test #33:

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

input:

23
12 18 13 19 14 20 15 21 16 22 17 23 2 1 4 3 6 5 8 7 10 9 11

output:

0 23
0 101
0 230
0 295
0 208
0 69
0 6
1 5
3 44
4 10
5 1
15 1
27 62
38 110
49 135
60 96
71 37
82 6
94 5
107 4
121 3
136 2
152 1

result:

ok 46 numbers

Test #34:

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

input:

23
14 19 15 20 16 21 17 22 18 23 2 1 4 3 6 5 8 7 10 9 12 11 13

output:

0 23
0 107
0 280
0 455
0 458
0 261
0 64
1 192
2 240
3 160
4 60
5 12
6 1
19 10
32 35
45 60
58 55
71 26
84 5
98 4
113 3
129 2
146 1

result:

ok 46 numbers

Test #35:

score: 0
Accepted
time: 7ms
memory: 104600kb

input:

26
7 2 16 21 23 4 1 5 12 24 13 14 8 18 10 3 11 6 22 17 19 20 9 15 25 26

output:

0 26
0 210
0 814
0 1800
0 2503
0 2326
0 1495
0 667
0 199
0 36
0 3
1 1
3 1
6 2
9 1
13 3
17 3
21 1
26 1
34 1
43 1
53 1
66 1
80 1
97 1
115 1

result:

ok 52 numbers

Test #36:

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

input:

26
23 19 21 18 2 4 7 8 5 9 16 12 11 25 20 17 10 26 24 6 15 3 14 1 22 13

output:

0 26
0 161
0 478
0 865
0 947
0 600
0 201
0 27
1 71
2 49
3 9
5 15
7 7
9 1
13 1
19 5
25 3
32 1
41 1
53 1
68 2
84 2
101 1
120 1
141 1
164 1

result:

ok 52 numbers

Test #37:

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

input:

26
5 10 2 17 19 7 8 6 20 11 1 3 22 4 23 14 24 16 9 12 15 25 26 18 21 13

output:

0 26
0 219
0 809
0 1570
0 1760
0 1185
0 477
0 112
0 15
0 1
2 2
4 1
7 1
10 2
13 1
18 3
23 1
29 2
35 1
42 1
50 2
58 1
68 2
79 1
92 1
106 1

result:

ok 52 numbers

Test #38:

score: 0
Accepted
time: 9ms
memory: 103856kb

input:

26
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

output:

0 26
0 325
0 2600
0 14950
0 65780
0 230230
0 657800
0 1562275
0 3124550
0 5311735
0 7726160
0 9657700
0 10400600
0 9657700
0 7726160
0 5311735
0 3124550
0 1562275
0 657800
0 230230
0 65780
0 14950
0 2600
0 325
0 26
0 1

result:

ok 52 numbers

Test #39:

score: 0
Accepted
time: 10ms
memory: 104324kb

input:

26
26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1

output:

0 26
1 325
3 2600
6 14950
10 65780
15 230230
21 657800
28 1562275
36 3124550
45 5311735
55 7726160
66 9657700
78 10400600
91 9657700
105 7726160
120 5311735
136 3124550
153 1562275
171 657800
190 230230
210 65780
231 14950
253 2600
276 325
300 26
325 1

result:

ok 52 numbers

Test #40:

score: 0
Accepted
time: 6ms
memory: 105252kb

input:

26
7 2 9 11 4 14 16 26 24 18 21 1 5 12 19 22 25 8 15 3 10 17 23 6 20 13

output:

0 26
0 188
0 595
0 999
0 999
0 637
0 262
0 66
0 8
1 12
2 6
3 1
6 1
10 2
14 1
19 1
25 1
32 1
41 1
51 2
61 1
72 1
86 1
102 2
119 2
137 1

result:

ok 52 numbers

Test #41:

score: 0
Accepted
time: 11ms
memory: 104988kb

input:

26
14 7 20 11 23 3 17 25 5 9 21 18 16 1 13 24 19 26 22 15 10 4 12 8 2 6

output:

0 26
0 139
0 273
0 254
0 105
0 14
1 21
2 6
4 11
6 6
8 1
11 1
15 4
19 1
25 1
33 1
43 4
53 2
64 1
77 1
91 1
106 1
124 1
143 1
163 1
186 1

result:

ok 52 numbers

Test #42:

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

input:

26
2 13 21 1 19 6 25 12 3 23 7 17 4 26 11 14 20 5 15 24 8 16 22 9 18 10

output:

0 26
0 184
0 560
0 885
0 793
0 408
0 110
0 12
1 20
2 11
3 2
5 1
8 4
11 1
15 1
20 1
27 4
34 1
43 2
53 3
64 2
76 1
90 1
105 1
123 2
141 1

result:

ok 52 numbers

Test #43:

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

input:

26
14 26 7 22 15 3 24 10 25 5 12 23 1 19 8 21 6 18 13 2 20 11 4 17 9 16

output:

0 26
0 138
0 238
0 156
0 33
1 66
2 33
3 1
5 1
8 6
11 2
15 3
19 1
24 1
31 3
38 1
47 2
57 2
68 2
80 1
94 1
109 1
126 1
144 1
163 1
187 1

result:

ok 52 numbers

Test #44:

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

input:

26
1 25 13 19 7 16 10 4 22 23 2 14 8 11 17 26 5 20 3 15 18 21 12 9 24 6

output:

0 26
0 171
0 495
0 765
0 690
0 373
0 114
0 15
1 25
2 10
4 23
6 15
8 3
11 1
16 1
22 1
29 1
38 5
47 2
58 5
69 1
82 1
97 3
112 1
131 1
154 1

result:

ok 52 numbers

Test #45:

score: 0
Accepted
time: 11ms
memory: 105872kb

input:

26
20 24 2 12 16 14 8 22 26 10 6 18 4 13 7 25 5 21 19 3 11 15 17 9 1 23

output:

0 26
0 146
0 320
0 335
0 176
0 45
0 5
1 3
3 4
6 16
9 15
12 2
16 1
21 1
28 11
34 2
41 1
50 2
60 1
72 2
85 1
100 2
116 1
134 1
155 1
179 1

result:

ok 52 numbers

Test #46:

score: 0
Accepted
time: 8ms
memory: 104540kb

input:

26
2 1 3 4 5 6 8 7 9 10 12 11 13 14 16 15 17 18 19 20 22 21 24 23 26 25

output:

0 26
0 318
0 2432
0 13039
0 52074
0 160664
0 391912
0 767103
0 1215566
0 1566070
0 1640640
0 1392065
0 948430
0 511380
0 213272
0 66352
0 14496
0 1984
0 128
1 448
2 672
3 560
4 280
5 84
6 14
7 1

result:

ok 52 numbers

Test #47:

score: 0
Accepted
time: 9ms
memory: 104368kb

input:

26
1 4 7 10 13 16 19 22 25 2 5 8 11 14 17 20 23 26 3 6 9 12 15 18 21 24

output:

0 26
0 217
0 920
0 2338
0 3836
0 4186
0 3032
0 1405
0 378
0 45
1 72
2 28
4 42
6 15
9 20
12 6
16 6
20 1
26 2
33 1
42 2
52 1
64 2
77 1
92 2
108 1

result:

ok 52 numbers

Test #48:

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

input:

26
1 14 2 15 3 16 4 17 5 18 6 19 7 20 8 21 9 22 10 23 11 24 12 25 13 26

output:

0 26
0 247
0 1300
0 4433
0 10582
0 18447
0 24024
0 23595
0 17446
0 9581
0 3796
0 1027
0 170
0 13
1 12
3 11
6 10
10 9
15 8
21 7
28 6
36 5
45 4
55 3
66 2
78 1

result:

ok 52 numbers

Test #49:

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

input:

26
25 23 21 19 17 15 13 11 9 7 5 3 1 26 24 22 20 18 16 14 12 10 8 6 4 2

output:

0 26
0 91
1 728
2 1001
4 4004
6 3003
9 6864
12 3003
16 4004
20 1001
25 728
30 91
36 28
42 1
50 2
59 1
70 2
82 1
96 2
111 1
128 2
146 1
166 2
187 1
210 2
234 1

result:

ok 52 numbers

Test #50:

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

input:

26
13 20 14 21 15 22 16 23 17 24 18 25 19 26 2 1 4 3 6 5 8 7 10 9 12 11

output:

0 26
0 130
0 342
0 520
0 458
0 218
0 50
0 7
1 6
3 5
5 12
6 1
15 2
21 1
35 12
49 60
63 160
77 240
90 50
102 7
115 6
129 5
144 4
160 3
177 2
195 1

result:

ok 52 numbers

Test #51:

score: 0
Accepted
time: 7ms
memory: 105216kb

input:

26
15 21 16 22 17 23 18 24 19 25 20 26 2 1 4 3 6 5 8 7 10 9 12 11 14 13

output:

0 26
0 135
0 390
0 695
0 768
0 485
0 134
1 453
2 672
3 560
4 280
5 84
6 14
7 1
21 12
35 51
49 110
63 135
77 96
91 37
105 6
120 5
136 4
153 3
171 2
190 1

result:

ok 52 numbers

Test #52:

score: 0
Accepted
time: 11ms
memory: 105348kb

input:

30
2 27 28 16 5 9 24 23 4 13 25 11 30 18 21 19 15 26 29 10 7 22 14 17 12 8 20 3 1 6

output:

0 30
0 176
0 467
0 659
0 517
0 222
0 48
0 4
1 4
2 1
4 2
6 1
9 1
13 1
19 2
25 1
33 2
42 3
52 4
63 4
75 3
88 1
103 4
118 1
137 1
159 3
181 1
205 1
231 1
259 1

result:

ok 60 numbers

Test #53:

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

input:

30
13 11 28 12 29 5 7 19 3 30 25 20 16 2 24 21 23 26 22 1 17 10 9 15 8 27 4 14 6 18

output:

0 30
0 191
0 417
0 435
0 274
0 108
0 23
0 2
2 12
4 23
6 15
8 2
11 1
15 1
21 2
27 1
35 1
44 1
54 3
64 1
76 1
89 2
103 1
119 3
135 1
153 1
174 2
195 1
219 1
244 1

result:

ok 60 numbers

Test #54:

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

input:

30
18 29 23 5 20 21 4 2 26 22 25 19 30 14 3 15 9 13 11 17 28 27 12 24 8 1 7 10 16 6

output:

0 30
0 171
0 348
0 284
0 108
0 14
1 20
2 6
4 11
6 3
9 3
12 1
16 2
20 1
26 1
35 3
45 6
56 10
67 1
79 9
90 1
103 2
117 1
133 1
151 1
170 2
190 1
213 1
237 1
264 1

result:

ok 60 numbers

Test #55:

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

input:

30
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

output:

0 30
0 435
0 4060
0 27405
0 142506
0 593775
0 2035800
0 5852925
0 14307150
0 30045015
0 54627300
0 86493225
0 119759850
0 145422675
0 155117520
0 145422675
0 119759850
0 86493225
0 54627300
0 30045015
0 14307150
0 5852925
0 2035800
0 593775
0 142506
0 27405
0 4060
0 435
0 30
0 1

result:

ok 60 numbers

Test #56:

score: 0
Accepted
time: 13ms
memory: 105648kb

input:

30
30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1

output:

0 30
1 435
3 4060
6 27405
10 142506
15 593775
21 2035800
28 5852925
36 14307150
45 30045015
55 54627300
66 86493225
78 119759850
91 145422675
105 155117520
120 145422675
136 119759850
153 86493225
171 54627300
190 30045015
210 14307150
231 5852925
253 2035800
276 593775
300 142506
325 27405
351 4060...

result:

ok 60 numbers

Test #57:

score: 0
Accepted
time: 11ms
memory: 105764kb

input:

30
3 1 9 13 5 7 11 15 30 22 28 20 18 26 24 17 6 2 10 25 29 14 21 19 12 4 27 23 8 16

output:

0 30
0 255
0 979
0 2043
0 2490
0 1786
0 728
0 150
0 12
1 24
2 15
3 3
5 7
7 5
9 1
12 1
17 3
22 4
27 1
34 1
43 2
52 1
63 1
75 1
88 1
102 1
118 1
137 1
158 1
180 1

result:

ok 60 numbers

Test #58:

score: 0
Accepted
time: 8ms
memory: 105904kb

input:

30
16 8 24 20 4 12 28 26 14 2 18 22 10 6 29 30 27 25 23 19 13 7 21 17 9 11 15 1 3 5

output:

0 30
0 175
0 345
0 267
0 101
0 23
0 2
1 1
3 3
6 4
10 17
14 15
18 4
23 1
30 21
36 3
43 2
51 1
61 2
72 2
84 2
97 1
112 3
127 1
145 2
163 1
182 1
207 1
233 1
260 1

result:

ok 60 numbers

Test #59:

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

input:

30
5 18 2 26 1 19 7 29 3 17 10 25 6 20 12 30 8 21 4 27 9 22 11 28 13 23 14 24 15 16

output:

0 30
0 263
0 1040
0 2193
0 2665
0 1925
0 824
0 204
0 29
0 2
1 1
3 3
5 2
8 6
11 7
14 4
17 1
22 1
28 3
34 2
41 1
50 2
59 1
70 1
84 2
98 1
113 1
129 1
150 1
172 1

result:

ok 60 numbers

Test #60:

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

input:

30
15 29 7 26 14 23 3 28 12 27 6 25 13 24 1 30 11 22 5 20 9 18 2 19 10 17 4 16 8 21

output:

0 30
0 176
0 330
0 266
0 94
0 13
1 14
2 2
4 1
7 14
10 13
13 2
17 1
22 1
28 3
34 1
43 2
52 1
63 2
74 1
86 1
100 1
116 5
132 2
150 6
168 1
188 2
209 1
232 1
259 1

result:

ok 60 numbers

Test #61:

score: 0
Accepted
time: 7ms
memory: 105680kb

input:

30
15 27 6 9 24 3 30 21 18 12 4 25 22 13 10 7 19 16 28 1 17 11 29 5 20 8 23 26 2 14

output:

0 30
0 209
0 609
0 871
0 675
0 314
0 91
0 15
0 1
2 3
4 3
6 1
9 2
12 1
16 2
20 1
26 1
34 4
42 2
51 2
61 2
72 1
85 1
101 3
117 1
134 1
153 1
175 1
199 1
226 1

result:

ok 60 numbers

Test #62:

score: 0
Accepted
time: 12ms
memory: 104392kb

input:

30
1 7 25 21 13 19 17 23 3 5 11 29 27 9 15 4 16 24 30 18 20 2 22 10 28 12 14 26 6 8

output:

0 30
0 227
0 733
0 1315
0 1481
0 1115
0 575
0 199
0 42
0 4
1 4
2 1
4 1
7 1
11 1
16 1
22 2
29 1
38 4
47 2
57 2
68 2
80 1
94 1
109 3
124 1
143 2
163 1
185 1
208 1

result:

ok 60 numbers

Test #63:

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

input:

30
1 2 3 4 5 6 8 7 9 10 11 12 13 14 15 16 17 18 20 19 21 22 24 23 26 25 28 27 30 29

output:

0 30
0 429
0 3892
0 25152
0 123240
0 475780
0 1484640
0 3811230
0 8149460
0 14640774
0 22225800
0 28605356
0 31249128
0 28949028
0 22672832
0 14930505
0 8197758
0 3707509
0 1357284
0 392172
0 86080
0 13488
0 1344
0 64
1 192
2 240
3 160
4 60
5 12
6 1

result:

ok 60 numbers

Test #64:

score: 0
Accepted
time: 11ms
memory: 105296kb

input:

30
3 1 10 5 12 7 16 18 14 21 24 30 26 28 8 19 22 29 15 11 2 25 6 20 13 27 4 23 9 17

output:

0 30
0 255
0 1020
0 2316
0 3226
0 2822
0 1525
0 482
0 83
0 6
1 7
2 2
4 5
6 4
8 1
11 4
14 2
18 1
24 1
31 1
40 3
49 1
60 1
73 3
86 2
100 1
118 1
137 1
157 1
180 1

result:

ok 60 numbers

Test #65:

score: 0
Accepted
time: 7ms
memory: 106172kb

input:

30
17 8 25 12 21 4 28 14 23 6 2 10 19 30 27 15 26 29 24 18 20 16 9 22 7 3 13 11 1 5

output:

0 30
0 179
0 384
0 355
0 156
0 31
0 2
2 12
4 16
6 4
9 12
12 7
15 1
20 4
25 3
31 3
38 1
47 6
55 1
64 1
75 1
89 1
104 1
121 1
139 1
158 1
179 1
203 1
228 1
256 1

result:

ok 60 numbers

Test #66:

score: 0
Accepted
time: 15ms
memory: 104728kb

input:

30
5 21 1 25 3 18 2 28 4 15 24 16 7 30 10 23 6 17 27 8 20 9 29 13 22 11 26 12 19 14

output:

0 30
0 253
0 937
0 1840
0 2148
0 1555
0 679
0 162
0 16
1 18
2 7
3 1
5 1
8 2
11 1
15 2
19 1
25 2
31 1
38 1
47 2
56 1
66 1
77 1
91 1
106 1
122 1
141 1
161 1
182 1

result:

ok 60 numbers

Test #67:

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

input:

30
29 8 30 16 4 28 12 23 2 25 13 27 5 24 11 21 1 22 10 26 6 20 9 19 3 18 15 7 17 14

output:

0 30
0 176
0 343
0 231
0 64
0 6
1 3
3 10
5 7
8 15
11 7
15 11
19 2
24 2
30 4
36 2
43 1
51 1
60 1
70 1
82 1
95 1
110 1
126 1
143 1
161 1
180 1
204 1
231 1
259 1

result:

ok 60 numbers

Test #68:

score: 0
Accepted
time: 7ms
memory: 104444kb

input:

30
16 22 8 26 4 12 28 2 10 24 6 18 14 30 1 19 15 25 7 21 11 29 3 20 13 27 5 23 9 17

output:

0 30
0 223
0 638
0 847
0 553
0 157
1 535
2 672
3 377
4 92
5 8
7 4
10 16
13 20
16 8
19 1
26 1
34 4
42 6
50 4
58 1
70 1
83 2
96 1
113 3
130 1
149 2
169 2
190 2
212 1

result:

ok 60 numbers

Test #69:

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

input:

30
1 16 2 17 3 18 4 19 5 20 6 21 7 22 8 23 9 24 10 25 11 26 12 27 13 28 14 29 15 30

output:

0 30
0 330
0 2030
0 8190
0 23478
0 50050
0 81510
0 102960
0 101530
0 78078
0 46410
0 20930
0 6930
0 1590
0 226
0 15
1 14
3 13
6 12
10 11
15 10
21 9
28 8
36 7
45 6
55 5
66 4
78 3
91 2
105 1

result:

ok 60 numbers

Test #70:

score: 0
Accepted
time: 7ms
memory: 105576kb

input:

30
29 27 25 23 21 19 17 15 13 11 9 7 5 3 1 30 28 26 24 22 20 18 16 14 12 10 8 6 4 2

output:

0 30
0 120
1 1120
2 1820
4 8736
6 8008
9 22880
12 12870
16 22880
20 8008
25 8736
30 1820
36 1120
42 120
49 32
56 1
65 2
75 1
87 2
100 1
115 2
131 1
149 2
168 1
189 2
211 1
235 2
260 1
287 2
315 1

result:

ok 60 numbers

Test #71:

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

input:

30
13 22 14 23 15 24 16 25 17 26 18 27 19 28 20 29 21 30 2 1 4 3 6 5 8 7 10 9 12 11

output:

0 30
0 177
0 568
0 1122
0 1452
0 1282
0 792
0 333
0 82
0 9
1 8
3 7
6 6
10 5
15 4
21 3
28 2
36 1
54 12
72 60
90 160
108 240
126 192
144 64
163 192
182 240
201 164
219 3
238 2
258 1

result:

ok 60 numbers

Test #72:

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

input:

30
15 23 16 24 17 25 18 26 19 27 20 28 21 29 22 30 2 1 4 3 6 5 8 7 10 9 12 11 14 13

output:

0 30
0 176
0 560
0 1078
0 1288
0 924
0 360
0 65
0 8
1 7
3 6
5 84
6 14
7 1
21 18
28 1
44 14
60 84
76 280
91 476
105 232
119 65
133 8
148 7
164 6
181 5
199 4
218 3
238 2
259 1

result:

ok 60 numbers

Test #73:

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

input:

32
18 10 23 6 14 9 5 19 7 20 15 22 12 28 13 3 1 30 27 21 32 25 26 8 24 16 17 11 31 2 4 29

output:

0 32
0 278
0 1020
0 1890
0 1877
0 988
0 250
0 24
1 34
2 15
3 2
5 5
7 4
9 1
13 6
17 9
21 2
26 10
31 12
36 4
42 5
48 1
57 1
69 3
81 1
95 3
110 3
126 1
144 1
163 1
190 1
218 1

result:

ok 64 numbers

Test #74:

score: 0
Accepted
time: 7ms
memory: 104992kb

input:

32
26 30 21 10 18 31 20 15 6 22 13 1 24 12 28 9 27 25 5 7 16 14 8 3 29 2 23 4 19 32 11 17

output:

0 32
0 210
0 515
0 593
0 341
0 109
0 25
0 3
1 3
3 4
5 1
9 4
13 1
18 1
24 2
31 4
38 1
46 1
55 3
64 1
75 1
87 1
100 1
114 1
130 2
147 1
166 1
187 2
208 1
233 2
258 1
286 1

result:

ok 64 numbers

Test #75:

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

input:

32
6 19 15 10 30 27 20 7 14 1 2 8 16 18 17 11 21 5 24 9 23 13 22 28 3 32 29 26 12 31 4 25

output:

0 32
0 298
0 1336
0 3401
0 5290
0 5197
0 3237
0 1239
0 265
0 24
1 48
2 30
3 6
5 17
7 11
9 2
12 1
16 6
20 5
24 1
29 1
36 2
44 2
53 1
64 2
76 1
90 1
106 1
126 2
147 1
171 1
198 1

result:

ok 64 numbers

Test #76:

score: 0
Accepted
time: 11ms
memory: 105188kb

input:

32
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

output:

0 32
0 496
0 4960
0 35960
0 201376
0 906192
0 3365856
0 10518300
0 28048800
0 64512240
0 129024480
0 225792840
0 347373600
0 471435600
0 565722720
0 601080390
0 565722720
0 471435600
0 347373600
0 225792840
0 129024480
0 64512240
0 28048800
0 10518300
0 3365856
0 906192
0 201376
0 35960
0 4960
0 496...

result:

ok 64 numbers

Test #77:

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

input:

32
32 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1

output:

0 32
1 496
3 4960
6 35960
10 201376
15 906192
21 3365856
28 10518300
36 28048800
45 64512240
55 129024480
66 225792840
78 347373600
91 471435600
105 565722720
120 601080390
136 565722720
153 471435600
171 347373600
190 225792840
210 129024480
231 64512240
253 28048800
276 10518300
300 3365856
325 90...

result:

ok 64 numbers

Test #78:

score: 0
Accepted
time: 25ms
memory: 104604kb

input:

32
1 5 7 11 9 3 13 26 15 17 32 19 21 28 30 23 24 6 14 27 2 10 18 31 22 4 12 29 20 8 25 16

output:

0 32
0 300
0 1337
0 3528
0 6284
0 8125
0 7858
0 5704
0 3070
0 1192
0 317
0 52
0 4
1 4
2 1
5 2
9 5
13 3
18 3
24 3
31 3
39 2
48 1
59 1
72 3
85 1
100 3
115 1
133 2
152 1
174 2
196 1

result:

ok 64 numbers

Test #79:

score: 0
Accepted
time: 7ms
memory: 105084kb

input:

32
16 25 8 20 4 29 12 22 31 27 18 14 10 6 2 24 32 30 28 23 15 26 21 7 13 19 17 11 5 9 3 1

output:

0 32
0 188
0 359
0 270
0 69
1 180
2 137
3 30
5 43
7 11
10 10
13 1
17 1
22 3
27 1
34 1
42 1
51 1
61 3
71 2
82 2
94 1
108 1
124 1
141 3
158 1
178 1
199 1
222 1
248 1
277 1
308 1

result:

ok 64 numbers

Test #80:

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

input:

32
2 21 3 26 5 24 1 30 4 18 6 27 8 19 7 32 9 22 11 28 10 23 12 31 14 20 13 29 16 25 17 15

output:

0 32
0 307
0 1442
0 4066
0 7566
0 9642
0 8471
0 5056
0 1970
0 456
0 48
1 120
2 116
3 54
4 12
5 1
8 5
11 5
14 1
19 1
26 1
34 1
43 1
53 3
63 1
75 1
91 2
107 1
126 2
145 1
167 2
189 1

result:

ok 64 numbers

Test #81:

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

input:

32
30 14 31 7 32 15 29 3 27 13 24 5 25 11 28 1 23 12 22 4 26 8 21 16 2 20 9 19 6 17 10 18

output:

0 32
0 189
0 374
0 315
0 123
0 20
0 1
2 8
4 13
6 5
9 5
13 13
17 7
21 1
27 2
34 2
42 2
51 4
60 2
70 2
81 1
94 1
109 5
124 3
140 1
158 3
176 1
198 1
223 1
250 1
278 1
307 1

result:

ok 64 numbers

Test #82:

score: 0
Accepted
time: 7ms
memory: 108268kb

input:

32
2 26 11 23 32 20 29 8 17 14 5 3 9 30 15 24 12 18 27 6 21 1 28 16 4 31 22 7 19 10 25 13

output:

0 32
0 245
0 778
0 1313
0 1283
0 729
0 225
0 29
1 51
2 25
3 3
5 1
8 6
11 4
15 19
19 16
23 3
28 2
34 1
41 1
51 1
63 3
75 1
90 2
106 2
123 5
140 5
157 1
177 1
200 1
224 1
251 1

result:

ok 64 numbers

Test #83:

score: 0
Accepted
time: 8ms
memory: 106112kb

input:

32
5 19 25 9 31 21 13 17 7 23 27 1 29 15 3 11 8 4 10 18 22 28 2 26 20 30 32 24 12 16 6 14

output:

0 32
0 259
0 872
0 1581
0 1739
0 1196
0 502
0 118
0 12
1 10
2 2
5 20
7 1
10 1
14 5
18 5
22 1
28 2
35 2
43 2
52 1
63 4
74 1
87 1
101 1
115 1
131 2
147 1
166 1
187 1
211 1
237 1

result:

ok 64 numbers

Test #84:

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

input:

32
2 1 4 3 5 6 7 8 9 10 12 11 13 14 16 15 18 17 19 20 21 22 23 24 25 26 28 27 29 30 32 31

output:

0 32
0 489
0 4750
0 32936
0 173544
0 722260
0 2436200
0 6780510
0 15771920
0 30939694
0 51507348
0 73056956
0 88459840
0 91447284
0 80570888
0 60276169
0 38058768
0 20103025
0 8772302
0 3106740
0 870424
0 185648
0 28320
0 2752
0 128
1 448
2 672
3 560
4 280
5 84
6 14
7 1

result:

ok 64 numbers

Test #85:

score: 0
Accepted
time: 11ms
memory: 108220kb

input:

32
2 4 6 14 12 8 10 16 23 18 30 26 28 21 32 20 1 24 17 9 5 31 13 27 22 3 11 29 19 7 25 15

output:

0 32
0 290
0 1207
0 2884
0 4440
0 4529
0 3026
0 1283
0 323
0 42
0 2
1 1
3 6
5 9
7 2
10 1
14 7
18 5
23 4
29 3
36 2
44 1
54 1
66 1
79 1
93 1
109 1
126 3
143 4
160 1
183 2
206 1

result:

ok 64 numbers

Test #86:

score: 0
Accepted
time: 13ms
memory: 106036kb

input:

32
18 8 26 12 4 22 29 15 31 24 20 6 10 2 13 27 16 30 23 28 32 25 17 21 11 19 7 5 14 3 9 1

output:

0 32
0 205
0 527
0 669
0 446
0 153
0 24
0 1
2 7
4 8
6 2
9 5
12 2
16 3
20 1
26 5
32 1
40 3
48 2
58 7
68 6
78 1
93 3
108 1
124 1
142 1
161 1
184 2
207 1
232 1
260 1
291 1

result:

ok 64 numbers

Test #87:

score: 0
Accepted
time: 11ms
memory: 104000kb

input:

32
2 22 5 26 6 16 30 3 21 8 28 9 19 11 32 4 20 1 27 13 23 7 31 10 18 25 15 17 29 12 24 14

output:

0 32
0 283
0 1084
0 2248
0 2863
0 2359
0 1260
0 417
0 77
0 6
1 4
3 16
5 17
7 5
10 4
14 4
19 7
24 3
30 1
37 1
45 1
54 3
63 1
74 1
86 3
98 1
113 1
130 1
148 1
168 1
190 1
213 1

result:

ok 64 numbers

Test #88:

score: 0
Accepted
time: 8ms
memory: 104148kb

input:

32
32 13 26 5 31 10 29 3 16 30 7 25 9 28 1 27 14 21 4 24 15 8 18 17 2 23 12 22 6 20 11 19

output:

0 32
0 210
0 526
0 617
0 346
0 98
0 16
1 40
2 28
3 6
5 4
8 9
11 2
15 4
19 1
24 1
30 1
38 3
46 1
55 3
64 1
76 1
90 1
106 5
122 2
140 4
158 1
180 1
204 2
228 1
255 1
286 1

result:

ok 64 numbers

Test #89:

score: 0
Accepted
time: 16ms
memory: 105788kb

input:

32
1 4 7 10 13 16 19 22 25 28 31 2 5 8 11 14 17 20 23 26 29 32 3 6 9 12 15 18 21 24 27 30

output:

0 32
0 331
0 1770
0 5820
0 12792
0 19614
0 21372
0 16545
0 8920
0 3191
0 682
0 66
1 110
2 45
4 72
6 28
9 42
12 15
16 20
20 6
25 6
30 1
37 2
45 1
55 2
66 1
79 2
93 1
109 2
126 1
145 2
165 1

result:

ok 64 numbers

Test #90:

score: 0
Accepted
time: 12ms
memory: 105980kb

input:

32
16 18 14 20 12 22 10 24 8 26 6 28 4 30 2 32 1 31 3 29 5 27 7 25 9 23 11 21 13 19 15 17

output:

0 32
0 248
0 560
0 784
0 728
0 448
0 176
0 40
0 4
1 2
3 2
6 2
10 2
15 2
21 2
28 2
36 2
45 2
55 2
66 2
78 2
91 2
105 2
120 2
136 16
152 56
168 112
184 140
200 112
216 56
232 16
248 1

result:

ok 64 numbers

Test #91:

score: 0
Accepted
time: 18ms
memory: 105140kb

input:

32
16 24 8 28 4 20 12 30 2 22 10 26 6 18 14 32 1 19 15 27 7 23 11 31 3 21 13 29 5 25 9 17

output:

0 32
0 248
0 734
0 979
0 616
0 167
1 552
2 680
3 378
4 92
5 8
7 4
10 16
13 20
16 8
19 1
26 2
34 9
42 12
50 8
58 2
70 4
82 2
95 6
108 6
121 1
140 4
159 2
180 6
201 1
224 2
248 1

result:

ok 64 numbers

Test #92:

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

input:

32
1 17 2 18 3 19 4 20 5 21 6 22 7 23 8 24 9 25 10 26 11 27 12 28 13 29 14 30 15 31 16 32

output:

0 32
0 376
0 2480
0 10780
0 33488
0 77896
0 139568
0 195910
0 217360
0 191048
0 132496
0 71708
0 29680
0 9080
0 1936
0 257
0 16
1 15
3 14
6 13
10 12
15 11
21 10
28 9
36 8
45 7
55 6
66 5
78 4
91 3
105 2
120 1

result:

ok 64 numbers

Test #93:

score: 0
Accepted
time: 11ms
memory: 105240kb

input:

32
31 29 27 25 23 21 19 17 15 13 11 9 7 5 3 1 32 30 28 26 24 22 20 18 16 14 12 10 8 6 4 2

output:

0 32
0 136
1 1360
2 2380
4 12376
6 12376
9 38896
12 24310
16 48620
20 19448
25 24752
30 6188
36 4760
42 680
49 272
56 17
64 2
73 1
84 2
96 1
110 2
125 1
142 2
160 1
180 2
201 1
224 2
248 1
274 2
301 1
330 2
360 1

result:

ok 64 numbers

Test #94:

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

input:

32
15 24 16 25 17 26 18 27 19 28 20 29 21 30 22 31 23 32 2 1 4 3 6 5 8 7 10 9 12 11 14 13

output:

0 32
0 201
0 688
0 1442
0 1932
0 1666
0 920
0 333
0 82
0 9
1 8
3 7
6 20
7 1
15 4
21 3
28 2
36 1
54 14
72 84
90 280
108 560
126 672
144 448
162 136
178 7
195 6
213 5
232 4
252 3
273 2
295 1

result:

ok 64 numbers

Test #95:

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

input:

32
17 25 18 26 19 27 20 28 21 29 22 30 23 31 24 32 2 1 4 3 6 5 8 7 10 9 12 11 14 13 16 15

output:

0 32
0 204
0 728
0 1638
0 2408
0 2268
0 1256
0 321
0 8
1 7
3 1798
4 1120
5 448
6 112
7 16
8 1
24 16
40 92
56 280
72 518
88 616
104 476
120 232
136 65
152 8
169 7
187 6
206 5
226 4
247 3
269 2
292 1

result:

ok 64 numbers

Test #96:

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

input:

34
5 29 22 32 33 20 10 26 1 19 4 30 31 24 3 8 14 11 13 9 21 28 6 34 12 15 27 25 17 18 2 23 16 7

output:

0 34
0 255
0 808
0 1339
0 1285
0 747
0 268
0 58
0 6
1 7
2 2
4 1
7 4
10 3
14 11
18 9
22 1
27 1
33 1
40 1
48 1
57 1
70 1
84 1
100 1
118 3
136 3
154 1
173 1
197 1
223 2
250 4
277 1
306 1

result:

ok 68 numbers

Test #97:

score: 0
Accepted
time: 7ms
memory: 104968kb

input:

34
11 26 10 14 18 20 13 5 19 6 2 30 22 17 12 25 8 27 16 34 3 31 1 29 23 33 7 28 4 32 21 9 24 15

output:

0 34
0 313
0 1129
0 2027
0 2097
0 1369
0 594
0 158
0 20
1 44
2 33
3 10
4 1
7 2
10 1
14 2
18 1
24 2
30 1
37 4
44 5
51 1
59 1
68 1
78 2
89 2
101 1
119 3
137 1
157 2
178 2
200 2
223 1
248 1

result:

ok 68 numbers

Test #98:

score: 0
Accepted
time: 7ms
memory: 105996kb

input:

34
34 31 1 25 16 19 28 18 15 3 10 33 21 12 4 26 5 13 24 23 32 6 20 17 14 29 9 22 8 2 27 11 30 7

output:

0 34
0 248
0 818
0 1480
0 1598
0 1065
0 434
0 100
0 10
1 15
2 3
4 4
6 1
9 3
12 1
17 2
23 1
31 4
39 15
46 4
54 3
63 1
74 1
86 1
102 1
119 1
137 1
157 1
178 3
199 1
224 1
250 1
280 1
313 1

result:

ok 68 numbers

Test #99:

score: -100
Wrong Answer
time: 0ms
memory: 105192kb

input:

34
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

output:

0 34
0 561
0 5984
0 46376
0 278256
0 1344904
0 5379616
0 18156204
0 52451256
0 131128140
0 286097760
0 548354040
0 927983760
0 1391975640
0 1855967520
0 -2091005866
0 -1961361076
0 -2091005866
0 1855967520
0 1391975640
0 927983760
0 548354040
0 286097760
0 131128140
0 52451256
0 18156204
0 5379616
0...

result:

wrong answer 32nd numbers differ - expected: '2203961430', found: '-2091005866'