QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#519042#5076. Prof. Pang and AntszhouhuanyiWA 959ms14500kbC++142.6kb2024-08-14 15:38:572024-08-14 15:38:58

Judging History

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

  • [2024-08-14 15:38:58]
  • 评测
  • 测评结果:WA
  • 用时:959ms
  • 内存:14500kb
  • [2024-08-14 15:38:57]
  • 提交

answer

#include<iostream>
#include<cstdio>
#include<algorithm>
#include<cmath>
#include<vector>
#define N 600000
using namespace std;
const long long inf=(long long)(3e14);
long long read()
{
	char c=0;
	long long sum=0;
	while (c<'0'||c>'9') c=getchar();
	while ('0'<=c&&c<='9') sum=sum*10+c-'0',c=getchar();
	return sum;
}
struct reads
{
	long long l,r;
	int sz;
};
reads tong[N+1];
struct rds
{
	long long num;
	int data;
	bool operator < (const rds &t)const
	{
		return num<t.num;	
	}
};
rds st[N+1];
int T,n,l,r,length,leng,a[N+1];
long long m,ans;
long long get_rk(long long l,long long r,long long d,long long k)
{
	return l+(k+d-1)/d-1;
}
long long calc(long long l1,long long r1,int d1,long long l2,long long r2,int d2)
{
	if (d1>=d2) return l1+r2;
	else
	{
		if ((r1-l1+1)*d1>=(r2-l2+1)*d2) return get_rk(l1,r1,d1,(r2-l2+1)*d2)+l2;
		else return r1+get_rk(l2,r2,d2,(r2-l2+1)*d2-(r1-l1)*d1);
	}
}
bool check(long long x)
{
	int rst=0,d,ds;
	long long ps,dst=m<<1,res=0,tres=0;
	leng=0,length=1;
	for (int i=1;i<=n;++i) st[++leng]=(rds){a[i],1},st[++leng]=(rds){a[i],1},st[++leng]=(rds){a[i]+(x>>1),-1},st[++leng]=(rds){a[i]+((x+1)>>1),-1},tres+=x;
	if (tres<dst) return 0;
	sort(st+1,st+leng+1);
	for (int i=1;i<=leng;++i)
	{
		rst+=st[i].data;
		if (rst&&dst&&st[i].num!=st[i+1].num)
		{
			d=min(dst/rst,st[i+1].num-st[i].num),dst-=rst*d;
			if (d) tong[++length]=(reads){st[i].num,st[i].num+d-1,rst};
			if (dst&&d!=st[i+1].num-st[i].num) tong[++length]=(reads){st[i].num+d,st[i].num+d,(int)(dst)},dst=0;
		}
	}
	l=2,r=length;
	while (l<=r)
	{
		d=min((tong[l].r-tong[l].l+1)*tong[l].sz,(tong[r].r-tong[r].l+1)*tong[r].sz),res=max(res,calc(tong[l].l,tong[l].r,tong[l].sz,tong[r].l,tong[r].r,tong[r].sz));
		if (d==(tong[l].r-tong[l].l+1)*tong[l].sz&&d==(tong[r].r-tong[r].l+1)*tong[r].sz) l++,r--;
		else if (d==(tong[l].r-tong[l].l+1)*tong[l].sz)
		{
			l++,tong[r].r-=(d+tong[r].sz-1)/tong[r].sz,ds=(tong[r].sz-d%tong[r].sz)%tong[r].sz,ps=tong[r].r+1;
			if (tong[r].l>tong[r].r) r--;
			if (ds) tong[++r]=(reads){ps,ps,ds};
		}
		else
		{
			r--,tong[l].l+=(d+tong[l].sz-1)/tong[l].sz,ds=(tong[l].sz-d%tong[l].sz)%tong[l].sz,ps=tong[l].l-1;
			if (tong[l].l>tong[l].r) l++;
			if (ds) tong[--l]=(reads){ps,ps,ds};
		}
	}
	return res+2<=x;
}
int main()
{
	T=read();
	while (T--)
	{
		n=read(),m=read(),ans=0;
		for (int i=1;i<=n;++i) a[i]=read();
		sort(a+1,a+n+1);
		for (int i=log(inf)/log(2);i>=0;--i)
			if (ans+(1ll<<i)<=inf&&!check(ans+(1ll<<i)))
				ans+=(1ll<<i);
		printf("%lld\n",ans+1);
	}
	return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

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

input:

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

output:

6
9
4

result:

ok 3 number(s): "6 9 4"

Test #2:

score: 0
Accepted
time: 1ms
memory: 7948kb

input:

1
1 100000000000000
1000000000

output:

200000000000000

result:

ok 1 number(s): "200000000000000"

Test #3:

score: 0
Accepted
time: 1ms
memory: 7944kb

input:

1
10 1
1 1 1 1 1 1 1 1 1 1

output:

4

result:

ok 1 number(s): "4"

Test #4:

score: 0
Accepted
time: 106ms
memory: 7932kb

input:

100000
1 76
95
1 60
68
1 81
86
1 88
67
1 69
28
1 75
65
1 56
22
1 88
60
1 51
41
1 64
11
1 54
71
1 63
19
1 88
5
1 89
66
1 80
66
1 81
48
1 67
99
1 94
36
1 54
46
1 51
37
1 82
17
1 74
41
1 69
61
1 79
65
1 78
10
1 71
17
1 87
88
1 83
2
1 58
29
1 59
43
1 78
53
1 75
73
1 77
71
1 52
82
1 63
69
1 83
19
1 61
27...

output:

267
197
254
223
138
206
112
209
134
128
197
126
176
222
213
178
266
188
147
126
164
157
192
210
156
142
264
166
117
146
185
222
220
217
202
166
122
162
250
214
160
158
220
132
108
213
198
276
226
197
204
140
146
215
122
142
201
269
269
188
144
246
251
200
217
184
192
139
234
128
190
242
254
166
152
...

result:

ok 100000 numbers

Test #5:

score: 0
Accepted
time: 683ms
memory: 7964kb

input:

100000
2 87
72 38
2 73
58 25
2 84
71 78
2 91
83 34
2 56
26 24
2 63
97 73
2 67
11 91
2 56
44 55
2 67
34 53
2 93
19 72
2 55
29 91
2 78
2 70
2 56
28 83
2 77
33 5
2 98
60 76
2 63
82 59
2 82
50 72
2 73
91 40
2 85
97 41
2 60
35 14
2 86
51 74
2 61
52 37
2 96
35 45
2 85
23 15
2 96
45 92
2 96
76 4
2 58
55 98...

output:

155
121
192
160
79
203
114
128
122
132
114
101
113
78
186
174
164
154
168
80
169
121
129
85
186
118
169
207
114
166
165
150
98
129
183
171
225
158
117
94
88
190
119
128
187
112
187
184
138
177
166
149
76
179
125
102
64
99
188
185
126
128
88
80
87
150
127
191
102
166
214
96
116
122
187
206
120
122
98...

result:

ok 100000 numbers

Test #6:

score: 0
Accepted
time: 741ms
memory: 7968kb

input:

100000
3 87
37 25 86
3 94
64 78 24
3 55
89 60 41
3 64
54 100 33
2 74
13 95
2 83
89 17
2 51
81 64
2 97
1 91
3 82
41 61 94
3 66
3 50 46
3 84
49 45 48
2 62
6 54
3 67
6 73 7
2 95
44 48
3 80
84 21 42
2 94
11 97
2 79
98 87
3 91
44 31 21
2 84
63 15
3 75
80 57 96
2 87
93 74
2 74
69 19
2 80
18 38
2 96
87 30
...

output:

107
136
130
120
122
127
172
127
144
78
124
82
67
141
104
136
226
96
115
176
212
113
97
157
132
140
104
105
116
174
116
114
91
85
166
133
94
70
185
104
140
117
90
168
116
108
152
127
130
167
97
155
87
76
225
136
149
103
75
187
161
104
98
113
81
120
112
94
97
130
156
60
97
95
200
100
132
89
147
126
21...

result:

ok 100000 numbers

Test #7:

score: 0
Accepted
time: 865ms
memory: 8008kb

input:

100000
4 90
14 97 74 38
4 54
21 15 46 16
3 86
95 74 59
3 86
42 64 31
3 66
94 100 60
3 83
92 13 77
3 81
80 32 9
3 52
42 48 41
4 64
90 68 23 1
3 76
80 71 1
4 79
7 71 17 86
4 81
22 1 20 96
3 68
70 28 54
4 87
27 1 66 51
3 65
47 74 55
4 87
6 14 56 89
3 96
64 57 64
3 52
25 95 48
4 85
98 71 33 8
3 59
3 1 5...

output:

98
54
177
117
187
116
83
106
64
100
79
59
117
78
136
75
157
100
85
59
64
119
129
127
134
159
88
101
172
87
124
56
101
91
130
109
76
70
113
127
65
145
112
85
126
88
157
162
98
98
119
131
71
101
106
102
64
130
144
138
106
144
96
76
95
70
82
86
109
43
172
64
100
88
97
64
165
74
97
163
87
74
126
62
110
...

result:

ok 100000 numbers

Test #8:

score: 0
Accepted
time: 959ms
memory: 7924kb

input:

100000
3 52
91 84 66
3 55
47 65 9
5 93
20 100 49 93 100
5 68
51 47 88 33 33
4 62
26 65 53 80
4 85
88 52 51 70
5 79
66 27 7 29 87
5 84
86 82 11 45 23
5 67
43 87 96 62 79
3 99
85 59 49
3 59
19 20 57
5 64
73 18 62 57 61
5 96
10 11 7 1 79
3 63
77 57 6
3 93
13 76 22
5 71
18 72 37 72 19
4 91
54 51 70 88
5...

output:

177
75
117
99
111
145
70
77
140
159
70
101
48
85
92
74
148
117
64
123
54
101
86
50
108
105
169
100
66
85
53
98
113
86
130
99
115
75
87
62
131
88
72
113
96
87
73
88
106
197
106
87
79
93
99
104
129
81
82
73
100
84
96
132
84
91
93
158
169
89
67
118
84
73
95
87
118
48
90
104
107
119
89
66
93
56
62
110
1...

result:

ok 100000 numbers

Test #9:

score: 0
Accepted
time: 929ms
memory: 7880kb

input:

83333
6 55
56 67 50 53 91 87
5 99
16 62 37 23 4
5 53
100 45 65 26 45
6 54
12 32 96 87 36 75
5 90
84 82 26 11 34
5 85
16 61 18 63 37
6 100
48 25 1 9 29 63
6 70
17 17 96 31 8 21
5 80
32 94 43 19 91
5 51
88 29 41 92 9
5 53
26 62 51 31 7
5 81
45 3 56 26 81
5 79
83 78 24 26 20
4 88
89 33 92 49
5 90
79 77...

output:

126
64
96
72
79
77
58
50
91
65
61
74
74
127
106
61
44
58
61
169
126
71
116
108
41
75
111
97
88
50
108
113
72
115
100
98
70
78
93
91
80
64
125
64
76
59
96
107
69
92
71
75
112
88
100
148
105
79
80
68
83
46
56
96
40
88
44
79
67
85
84
54
84
86
78
131
102
74
59
66
51
100
106
95
58
156
134
84
131
55
68
58...

result:

ok 83333 numbers

Test #10:

score: 0
Accepted
time: 854ms
memory: 7968kb

input:

71428
4 67
32 43 42 20
4 81
56 97 53 77
5 87
62 29 93 48 31
5 60
6 62 75 69 45
6 64
2 70 14 99 96 12
4 53
41 23 99 97
6 65
47 49 14 18 7 42
7 52
45 55 16 61 38 64 100
6 76
60 26 15 93 79 63
5 67
24 83 11 37 13
5 65
19 6 30 17 8
4 77
73 95 17 54
4 57
18 42 86 52
6 68
42 71 17 12 70 7
4 86
88 2 78 44
...

output:

86
151
102
75
43
92
49
81
80
56
43
111
90
48
90
126
117
59
87
54
72
79
59
81
95
78
105
72
59
85
132
99
122
76
51
117
122
75
46
74
61
145
116
84
110
114
78
76
135
89
93
64
77
67
68
100
78
152
81
98
157
89
158
58
48
71
170
90
77
70
112
44
52
103
70
48
96
58
45
67
63
60
38
56
107
48
83
121
101
112
58
1...

result:

ok 71428 numbers

Test #11:

score: 0
Accepted
time: 844ms
memory: 7972kb

input:

62500
6 66
13 26 30 76 55 74
8 92
87 100 71 60 24 47 38 1
5 87
81 67 74 92 30
5 83
32 81 57 46 8
8 92
72 90 47 24 14 82 74 3
6 57
58 36 74 64 96 87
6 59
50 48 63 19 4 50
7 91
4 39 50 60 90 13 51
5 81
30 49 88 52 21
6 55
38 67 64 92 54 4
7 85
96 55 76 56 58 97 17
8 54
54 18 55 25 43 82 94 27
7 72
64 ...

output:

69
73
142
83
60
124
56
67
93
66
115
66
74
58
97
81
107
59
58
96
67
70
79
63
58
78
77
66
101
55
83
94
68
48
94
81
88
89
73
58
69
74
132
75
55
93
34
56
64
70
96
61
64
80
64
83
56
86
63
88
113
80
75
54
93
76
116
53
38
75
117
78
92
52
104
46
106
57
100
89
55
104
81
60
59
41
62
127
66
72
67
91
73
67
78
1...

result:

ok 62500 numbers

Test #12:

score: 0
Accepted
time: 804ms
memory: 7960kb

input:

55555
5 70
78 5 18 31 38
8 90
78 24 11 88 90 74 69 91
5 87
97 64 24 82 13
9 74
99 58 51 44 83 12 100 71 51
7 62
17 32 67 28 100 14 72
6 58
32 78 48 68 94 55
8 80
84 62 20 53 48 30 82 70
5 95
14 4 89 18 64
5 61
63 86 82 89 8
8 64
20 18 78 39 30 49 43 9
9 94
67 8 78 13 6 63 78 97 49
6 98
99 14 29 30 6...

output:

59
86
84
94
61
110
91
64
89
54
60
83
134
64
57
62
33
71
87
92
89
66
52
54
52
119
146
82
50
57
84
81
75
94
60
99
86
52
79
127
59
71
118
54
46
68
64
84
138
104
55
68
82
67
44
49
83
65
52
62
68
100
97
44
44
43
111
116
36
85
28
49
42
28
89
40
73
44
48
92
116
37
67
63
63
87
129
79
53
45
76
51
53
54
62
52...

result:

ok 55555 numbers

Test #13:

score: 0
Accepted
time: 798ms
memory: 7968kb

input:

50000
8 100
62 38 26 51 26 23 77 32
6 94
16 27 2 21 50 53
9 97
18 5 22 91 72 81 68 6 34
7 52
94 4 72 42 65 60 57
10 62
79 72 40 86 42 27 38 57 94 10
10 95
89 8 47 95 54 2 73 53 37 72
8 74
16 54 82 90 23 5 89 19
6 71
71 65 65 50 78 16
9 73
40 91 48 41 45 69 40 18 78
10 84
84 81 32 48 51 59 17 38 55 6...

output:

79
58
51
66
69
64
51
103
89
87
91
31
58
67
106
38
57
117
71
54
124
90
51
65
63
55
122
44
137
52
59
44
63
76
108
40
60
54
68
75
55
52
112
69
83
74
57
38
44
44
83
97
56
54
62
53
78
98
100
60
33
50
96
59
105
134
54
72
42
108
71
60
74
77
109
59
44
61
95
66
63
64
44
106
42
49
102
60
61
125
73
76
84
43
48...

result:

ok 50000 numbers

Test #14:

score: 0
Accepted
time: 758ms
memory: 7964kb

input:

45454
11 54
39 25 14 10 9 62 25 22 38 17 33
11 56
39 91 1 65 15 93 62 31 12 29 1
11 82
12 2 89 3 8 2 13 2 71 53 84
8 83
61 23 2 86 53 93 79 50
6 68
91 35 95 72 38 58
11 86
89 15 8 88 55 36 45 16 42 13 28
9 94
91 23 54 18 69 1 39 42 98
7 62
51 90 91 68 7 57 30
8 92
74 100 24 74 73 20 37 18
10 73
30 2...

output:

40
30
26
73
108
49
63
69
73
60
73
56
36
55
48
81
93
62
100
91
52
84
39
78
41
56
55
59
106
72
62
78
57
65
65
42
100
98
97
49
78
55
59
29
94
43
35
88
91
35
48
94
37
69
30
94
55
64
49
56
48
59
52
54
48
58
44
42
60
69
93
105
63
88
54
50
61
42
49
52
112
59
47
80
53
69
68
69
149
81
100
66
47
76
81
73
66
5...

result:

ok 45454 numbers

Test #15:

score: 0
Accepted
time: 765ms
memory: 7956kb

input:

41666
7 61
4 9 2 74 95 14 72
8 71
40 50 64 14 53 39 46 39
10 77
23 47 33 90 13 4 58 83 93 21
10 62
36 80 40 86 54 98 90 92 58 11
9 80
67 63 93 94 88 38 95 70 86
7 93
74 9 99 28 92 39 53
12 63
44 42 91 4 47 4 62 26 79 41 63 85
9 91
69 26 39 84 23 37 41 86 45
7 83
100 1 72 9 76 16 89
9 61
19 16 88 100...

output:

32
85
51
79
140
83
47
86
56
48
32
72
60
66
54
79
76
71
63
81
71
52
32
85
46
50
53
62
95
59
52
70
97
42
54
53
109
76
132
56
36
55
55
69
112
64
45
37
53
54
140
139
54
63
88
76
56
43
61
67
68
71
55
82
140
73
51
92
29
50
57
49
82
55
89
54
90
84
70
73
50
36
69
99
46
39
41
41
91
118
74
44
74
53
69
38
43
5...

result:

ok 41666 numbers

Test #16:

score: 0
Accepted
time: 745ms
memory: 7964kb

input:

38461
12 65
80 80 82 29 73 54 16 7 8 55 67 86
10 75
84 95 21 33 56 80 63 50 47 26
7 77
61 80 57 20 16 61 51
7 92
47 9 67 46 46 94 25
9 85
18 10 45 78 67 91 4 77 6
12 79
20 16 59 78 62 7 24 87 31 76 36 90
11 70
41 56 39 28 16 93 98 51 95 42 82
11 95
83 90 1 83 82 44 65 11 66 17 27
13 63
70 81 20 3 10...

output:

44
80
76
81
44
55
80
52
34
43
55
41
37
85
48
66
42
38
34
49
52
35
97
71
57
51
71
51
42
76
48
111
43
77
47
41
55
69
37
67
58
43
59
49
51
47
42
81
60
74
78
50
69
43
38
52
51
67
47
99
61
88
107
58
55
84
78
73
66
60
76
133
32
72
50
56
64
69
48
41
54
81
78
49
39
43
60
61
28
58
42
47
74
49
37
63
55
57
70
...

result:

ok 38461 numbers

Test #17:

score: 0
Accepted
time: 735ms
memory: 7968kb

input:

35714
10 69
53 67 74 89 55 93 56 97 42 78
12 55
27 93 25 43 6 51 39 41 71 71 8 46
13 99
32 67 90 25 25 95 26 19 99 48 31 52 1
10 78
32 10 99 85 20 1 67 87 84 42
11 77
95 83 28 25 98 60 97 72 5 7 30
14 93
76 77 28 21 90 92 7 73 5 52 99 25 66 17
12 59
30 40 24 17 94 51 30 20 56 33 74 100
10 93
47 21 9...

output:

122
43
60
49
52
50
62
84
42
57
60
62
59
34
47
81
55
52
81
53
48
61
59
150
65
64
53
57
37
61
70
48
38
73
89
43
72
72
43
40
63
52
66
60
77
88
56
72
96
47
47
71
74
62
68
62
55
76
60
47
73
58
36
47
40
28
65
34
37
50
62
64
63
51
46
29
58
47
36
55
73
67
65
69
45
100
67
50
45
34
69
54
48
66
35
64
65
38
67
...

result:

ok 35714 numbers

Test #18:

score: 0
Accepted
time: 723ms
memory: 8072kb

input:

33333
11 80
22 42 58 48 42 37 99 87 79 93 5
10 77
15 78 84 84 60 18 2 80 88 61
10 61
25 6 71 26 38 25 25 1 52 18
12 96
45 63 32 58 56 54 17 44 34 41 56 7
15 77
46 52 50 99 39 39 37 34 28 33 94 35 29 48 38
10 96
39 96 16 52 94 18 13 3 51 52
12 52
92 34 80 90 50 51 11 62 91 29 55 41
13 84
50 20 21 26 ...

output:

68
52
38
70
79
51
67
57
52
78
42
32
88
87
47
58
112
90
86
64
66
66
79
56
70
77
90
84
57
53
53
70
42
65
36
128
127
53
29
42
51
55
48
36
51
87
37
55
45
51
31
43
44
58
51
70
36
41
67
58
55
63
61
43
69
42
52
42
78
58
70
36
65
67
42
39
45
59
104
50
42
90
54
64
75
51
79
40
39
35
80
67
42
42
60
50
55
82
69...

result:

ok 33333 numbers

Test #19:

score: 0
Accepted
time: 726ms
memory: 7888kb

input:

31250
10 84
99 26 46 4 20 72 43 77 12 16
14 54
39 33 19 32 62 69 94 59 100 10 21 79 81 47
13 58
59 47 33 55 75 90 24 41 64 22 10 21 37
15 94
43 10 51 97 45 40 76 7 33 73 97 3 42 48 72
12 59
91 71 54 20 82 86 45 19 47 63 51 4
13 71
21 49 11 82 13 91 52 94 23 39 69 89 23
10 60
46 41 57 73 76 66 94 99 ...

output:

48
53
54
52
50
52
97
61
53
36
61
40
50
47
37
78
100
48
58
101
118
38
103
73
40
40
70
42
40
57
54
52
67
48
70
42
49
62
57
50
50
59
73
88
42
44
41
86
79
44
42
47
116
42
86
51
115
78
80
43
47
40
55
56
70
33
63
62
33
61
69
56
59
43
43
46
48
61
35
53
61
42
74
39
41
73
43
37
46
95
61
56
50
49
52
41
72
43
...

result:

ok 31250 numbers

Test #20:

score: 0
Accepted
time: 712ms
memory: 7932kb

input:

29411
17 83
76 1 38 63 2 16 95 76 45 27 31 68 90 55 63 85 52
10 73
16 8 31 82 87 52 73 59 49 95
12 83
84 50 32 35 38 79 7 64 13 25 75 34
15 69
69 49 35 60 68 45 20 94 52 7 53 65 8 93 87
11 56
78 19 8 39 35 30 59 43 81 60 72
13 86
100 68 20 37 26 24 66 69 85 88 26 40 73
14 55
43 66 20 14 90 67 74 28 ...

output:

44
62
59
48
56
71
53
50
95
109
52
44
29
45
48
77
55
44
33
41
77
54
43
51
70
65
38
79
36
43
46
58
47
47
51
48
46
72
43
50
73
105
80
82
40
39
78
46
50
66
59
62
67
51
33
67
49
59
79
62
47
71
40
54
58
58
71
35
39
45
39
53
44
67
29
69
48
50
68
70
31
69
39
52
38
72
55
56
45
60
60
45
84
43
70
58
33
56
42
5...

result:

ok 29411 numbers

Test #21:

score: 0
Accepted
time: 715ms
memory: 7884kb

input:

27777
16 95
52 88 22 19 88 56 34 66 87 54 49 91 52 77 12 33
15 92
56 73 16 48 35 8 30 91 25 44 23 64 41 10 25
11 96
31 89 92 22 10 8 86 78 76 36 87
14 70
88 64 88 11 19 3 20 61 74 51 71 18 21 45
11 60
46 88 18 49 70 18 11 20 59 69 40
18 70
47 65 69 87 38 16 34 7 56 56 84 86 68 29 78 72 56 6
17 94
21...

output:

68
52
60
44
50
44
84
53
62
49
33
79
33
109
50
75
40
40
39
74
39
33
48
37
35
58
53
28
55
75
49
56
61
72
80
84
60
54
55
48
31
51
61
63
40
93
73
42
48
59
59
64
54
42
68
51
48
77
63
88
35
31
51
60
67
56
35
60
46
56
67
54
68
42
59
39
63
38
47
44
40
61
37
40
35
47
48
50
59
62
88
55
58
26
52
86
59
42
64
39...

result:

ok 27777 numbers

Test #22:

score: 0
Accepted
time: 700ms
memory: 7948kb

input:

26315
10 52
17 68 14 74 67 95 78 60 16 73
15 55
2 95 61 74 3 1 39 34 37 73 96 24 96 13 96
10 60
69 41 40 96 7 56 28 12 81 77
18 96
98 18 90 94 1 44 9 9 56 26 2 40 54 28 72 91 90 57
18 79
30 25 9 80 37 12 64 86 93 41 72 41 26 56 5 72 73 89
19 59
2 62 88 25 94 61 95 43 74 24 94 31 90 30 13 10 22 37 21...

output:

50
28
50
37
45
38
38
43
47
50
34
44
43
54
68
59
35
47
56
45
37
35
51
53
47
41
56
64
52
39
97
79
38
60
52
63
33
46
41
25
50
66
36
32
46
67
37
67
40
35
44
52
54
47
57
85
28
36
48
47
71
49
38
24
46
60
60
48
66
78
46
50
89
48
46
55
90
55
62
44
50
44
50
37
66
48
65
80
32
32
52
62
59
51
46
63
43
56
61
41
...

result:

ok 26315 numbers

Test #23:

score: 0
Accepted
time: 699ms
memory: 8008kb

input:

25000
16 89
55 9 61 96 45 34 41 27 2 99 29 79 46 14 36 53
18 63
46 37 28 63 85 27 90 96 60 14 25 95 59 12 69 11 24 71
18 65
77 59 19 49 71 86 67 84 33 83 43 57 11 40 10 78 52 47
12 96
100 49 87 7 14 22 45 73 7 34 73 100
20 93
69 45 6 97 22 77 3 29 20 97 45 98 25 96 35 39 83 36 14 47
19 60
39 27 94 7...

output:

48
47
50
50
46
38
43
35
63
42
45
31
35
68
36
63
39
42
34
74
48
48
44
26
56
47
61
75
69
54
69
33
32
47
47
50
45
36
63
35
67
52
39
101
55
64
45
78
37
62
34
45
32
57
50
34
60
39
43
53
67
56
60
80
52
56
53
42
59
31
64
73
49
81
48
37
46
70
43
39
81
56
63
42
78
54
42
59
53
25
109
30
36
39
37
74
47
50
42
6...

result:

ok 25000 numbers

Test #24:

score: -100
Wrong Answer
time: 499ms
memory: 14500kb

input:

5
86904 975995989
8 10 10 2 3 6 9 6 6 6 4 1 3 3 9 8 6 2 10 3 9 5 10 3 5 3 10 2 6 3 1 9 1 6 9 8 2 6 3 9 8 3 1 4 6 2 7 8 8 8 4 7 10 5 10 10 5 2 4 2 7 4 4 5 2 6 9 8 6 2 6 3 10 8 8 8 4 9 1 10 10 2 9 7 1 1 6 10 6 3 8 6 5 5 4 4 8 2 1 2 7 8 1 2 10 6 7 4 3 9 6 5 6 1 10 3 3 3 8 9 5 7 6 5 9 7 1 1 7 3 6 2 5 3 ...

output:

212265765392405
208303624504427
201346301175200
300000000000001
256019875584397

result:

wrong answer 1st numbers differ - expected: '22462', found: '212265765392405'