QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#74357#21. GCD-sum1234567833 120ms19100kbC++143.3kb2023-01-31 21:19:092023-01-31 21:19:11

Judging History

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

  • [2023-08-10 23:21:45]
  • System Update: QOJ starts to keep a history of the judgings of all the submissions.
  • [2023-01-31 21:19:11]
  • 评测
  • 测评结果:33
  • 用时:120ms
  • 内存:19100kb
  • [2023-01-31 21:19:09]
  • 提交

answer

#include <bits/stdc++.h>
using namespace std;
#define int long long
#define mp make_pair
#define inf 1e9
#define pii pair <int, int>
const int mod = 1e9 + 7;
inline int read () {
	int x = 0, f = 1;
	char ch = getchar ();
	while (ch < '0' || ch > '9') f = ((ch == '-') ? -1 : f), ch = getchar ();
	while (ch >= '0' && ch <= '9') x = x * 10 + ch - '0', ch = getchar ();
	return x * f;
}
inline void write (int x) {
	if (x < 0) x = -x, putchar ('-');
	if (x >= 10) write (x / 10);
	putchar (x % 10 + '0');
}
inline int quickmod (int x, int y) {
	int Ans = 1;
	while (y) {
		if (y & 1) Ans = (1ll * Ans * x) % mod;
		x = (1ll * x * x) % mod;
		y >>= 1;
	}
	return Ans;
}
int n;
int a[500005];
int m;
int ans;
int s[500005];
pii b[500005];
map <int, int> M;

priority_queue <int, vector <int>, greater <int> > Q;
int chk() {
	if(!m || Q.empty()) return 0;
	int p2 = s[m-1] + b[m].first;
	int p3 = __gcd(s[m-2], b[m].first) + b[m-1].first;
	int mx = max(p2, p3);
	int tp = Q.top();
	if(mx < tp) return 0;
	ans -= tp, Q.pop(), M[tp]++;
	if(mx == p2) {
		ans += b[m].first;
		if(b[m].second != 1) M[b[m].first] += b[m].second - 1;
		m--;
	}
	else {
		swap(b[m], b[m-1]);
		s[m-1] = __gcd(s[m-2], b[m-1].first), s[m] = __gcd(s[m-1], b[m].first);
		ans += b[m].first;
		if(b[m].second != 1) M[b[m].first] += b[m].second - 1;
		m--;
	}
	return 1;
}
signed main () {
//	freopen (".in", "r", stdin);
//	freopen (".out", "w", stdout);
	n = read();
	for(int i = 1; i <= n; i++) a[i] = read();
	sort(a + 1, a + 1 + n);
	for(int i = 1; i <= n; i++) {
		if(i == 1 || a[i] != a[i-1]) b[++m] = mp(a[i], 1);
		else b[m].second++;
	}
	for(int i = 1; i <= m; i++) s[i] = __gcd(s[i-1], b[i].first);//, printf("{%lld %lld}\n", b[i].first, b[i].second);
	if(m == 1) {
		for(int i = 1; i <= n; i++) write(a[1] * i), putchar('\n');
		return 0;
	}
	if(m == 2) {
		write(s[2]), putchar('\n');
		for(int i = 2; i <= b[2].second + 1; i++) write(b[1].first + (i - 1) * b[2].first), putchar('\n');
		for(int i = 2; i <= b[1].second; i++) write(b[1].first * i + b[2].first * b[2].second), putchar('\n');
		return 0;
	}
	write(s[m]), putchar('\n');
	ans = 0, n--;
	while(n--) {
		if(m == 1) {
			ans += b[1].first;
			if(b[m].second != 1) M[b[m].first] += b[m].second - 1;
			m--;
		}
		while(chk());
		if(!m) {
			auto it = *(--M.end());
			ans += it.first, it.second--;
			if(!it.second) M.erase(it.first);
			write(ans), putchar('\n');
		}
		else {
			int p1 = -inf;
			if(!M.empty()) p1 = (*(--M.end())).first + s[m];
			int p2 = s[m-1] + b[m].first;
			int p3 = __gcd(s[m-2], b[m].first) + b[m-1].first;
			int mx = max(max(p1, p2), p3);
			if(mx == p1) {
				auto it = *(--M.end());
				ans += it.first, it.second--, Q.push(it.first);
				if(!it.second) M.erase(it.first);
				write(ans + s[m]), putchar('\n');
			}
			else if(mx != p3) {
				ans += b[m].first;
				if(b[m].second != 1) M[b[m].first] += b[m].second - 1;//, printf("!!\n");
				m--;
//				printf("A:%lld\n", p1);
				write(ans + s[m]), putchar('\n');
			}
			else {
				swap(b[m], b[m-1]);
				s[m-1] = __gcd(s[m-2], b[m-1].first), s[m] = __gcd(s[m-1], b[m].first);
				ans += b[m].first;
				if(b[m].second != 1) M[b[m].first] += b[m].second - 1;
				m--;
				write(ans + s[m]), putchar('\n');
			}
		}
	}
	return 0;
}
/*
7
6 10 11 12 12 15 30
*/

詳細信息

Subtask #1:

score: 0
Wrong Answer

Test #1:

score: 5
Accepted
time: 2ms
memory: 5384kb

input:

7
18 30 10 23 1 3 13

output:

1
31
54
72
85
95
98

result:

ok 7 lines

Test #2:

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

input:

7
11 12 12 15 30 6 10

output:

1
31
46
58
72
84
96

result:

ok 7 lines

Test #3:

score: 0
Accepted
time: 2ms
memory: 5392kb

input:

7
14 19 17 12 5 24 3

output:

1
25
44
61
75
87
94

result:

ok 7 lines

Test #4:

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

input:

7
13 15 19 21 27 28 30

output:

1
31
59
86
107
126
153

result:

ok 7 lines

Test #5:

score: -5
Wrong Answer
time: 1ms
memory: 5512kb

input:

7
4 8 12 13 13 13 24

output:

1
25
41
54
66
79
92

result:

wrong answer 5th lines differ - expected: '67', found: '66'

Subtask #2:

score: 0
Skipped

Dependency #1:

0%

Subtask #3:

score: 0
Wrong Answer

Test #31:

score: 8
Accepted
time: 2ms
memory: 5512kb

input:

100
268 467 21 173 158 287 36 446 36 340 311 283 58 77 464 119 460 198 405 331 214 331 255 157 418 319 354 289 330 64 11 484 186 129 130 368 370 468 292 180 427 76 87 156 13 379 268 170 3 15 263 52 296 242 7 296 376 148 221 270 218 131 326 198 399 132 270 55 299 444 134 222 278 486 409 72 38 193 359...

output:

1
497
990
1476
1960
2428
2895
3359
3819
4274
4720
5164
5591
6009
6420
6829
7234
7633
8028
8422
8801
9177
9547
9915
10277
10636
10990
11335
11675
12006
12337
12667
12993
13312
13623
13934
14244
14543
14839
15135
15427
15716
16003
16286
16564
16838
17108
17378
17646
17914
18181
18444
18699
18941
19166...

result:

ok 100 lines

Test #32:

score: -8
Wrong Answer
time: 1ms
memory: 5540kb

input:

100
481 171 450 127 152 475 484 86 266 265 354 457 493 439 102 277 387 150 217 412 84 103 78 446 66 133 369 373 193 244 339 173 288 171 330 21 471 473 228 131 139 102 408 59 10 25 472 382 422 375 448 72 242 453 196 337 287 389 497 154 243 77 50 211 216 408 450 370 353 213 154 463 13 459 154 154 201 ...

output:

1
498
991
1475
1957
2438
2913
3386
3858
4329
4798
5261
5720
6177
6630
7080
7530
7978
8424
8863
9299
9733
10158
10582
11004
11416
11824
12232
12621
13008
13390
13765
14138
14508
14877
15231
15584
15923
16260
16590
16917
17219
17513
17807
18095
18382
18659
18936
19208
19474
19739
19984
20228
20471
207...

result:

wrong answer 75th lines differ - expected: '24497', found: '24499'

Subtask #4:

score: 8
Accepted

Test #51:

score: 8
Accepted
time: 1ms
memory: 5292kb

input:

1270
1 2 6 7 8 9 10 11 13 14 16 18 19 20 22 23 25 26 28 30 31 32 33 37 38 40 42 43 44 45 46 47 48 49 50 52 53 55 56 57 58 59 62 63 64 67 68 69 70 71 72 74 75 77 78 80 85 86 87 88 89 90 92 96 97 98 99 100 101 103 104 105 107 108 109 113 119 122 124 126 128 132 134 135 137 140 143 144 149 150 151 154 ...

output:

1
1996
3990
5983
7975
9966
11955
13943
15928
17912
19895
21873
23849
25824
27796
29767
31737
33706
35674
37641
39607
41570
43531
45490
47447
49402
51354
53304
55251
57197
59142
61084
63024
64963
66900
68836
70770
72703
74632
76560
78487
80413
82337
84260
86182
88103
90023
91941
93856
95770
97683
995...

result:

ok 1270 lines

Test #52:

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

input:

1265
1 2 5 6 7 8 9 10 12 14 15 16 17 18 19 20 24 26 28 29 30 31 32 33 34 35 37 38 39 40 41 43 44 45 46 47 50 56 57 59 62 63 64 65 66 67 68 69 70 71 74 75 77 83 84 85 86 87 88 89 91 92 95 97 98 100 101 102 105 106 107 108 109 110 112 114 115 116 117 118 119 120 122 123 124 125 126 128 129 133 134 136...

output:

1
2001
4000
5998
7994
9989
11983
13976
15968
17957
19945
21932
23917
25901
27883
29864
31841
33817
35792
37766
39738
41709
43678
45646
47612
49575
51537
53496
55454
57411
59367
61321
63274
65225
67175
69124
71072
73019
74965
76909
78852
80794
82735
84675
86613
88549
90481
92412
94342
96271
98198
100...

result:

ok 1265 lines

Test #53:

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

input:

1291
1 2 4 5 8 9 11 12 14 18 19 21 22 23 24 25 28 30 31 32 33 34 35 36 37 39 41 42 43 44 45 48 52 53 54 57 58 61 62 63 64 65 67 71 72 73 74 76 77 78 80 81 82 85 88 89 91 92 97 99 100 101 102 103 104 105 106 107 108 110 113 114 115 118 120 121 122 123 124 126 128 129 132 134 135 137 140 141 142 143 1...

output:

1
2001
4000
5996
7990
9983
11975
13966
15956
17945
19933
21918
23902
25880
27857
29833
31808
33777
35745
37712
39677
41641
43604
45566
47527
49487
51446
53404
55361
57317
59268
61218
63166
65113
67059
69004
70945
72884
74822
76759
78695
80630
82563
84492
86419
88345
90270
92194
94117
96038
97958
998...

result:

ok 1291 lines

Test #54:

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

input:

21
1980 1981 1982 1983 1984 1985 1986 1987 1988 1989 1990 1991 1992 1993 1994 1995 1996 1997 1998 1999 2000
1980 1980 1980 1980 1980 1980 1980 1980 1980 1980 1980 1980 1980 1980 1980 1980 1980 1980 1980 1980 1980 1980 1980 1980 1980 1980 1980 1980 1980 1980 1980 1980 1980 1980 1980 1980 1980 1980 19...

output:

1
2001
4000
5998
7995
9991
11986
13980
15973
17965
19956
21946
23935
25923
27910
29896
31881
33865
35848
37830
41790

result:

ok 21 lines

Test #55:

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

input:

1002
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:

1
2001
3002
4002
5001
5999
6996
7992
8987
9981
10974
11966
12957
13947
14936
15924
16911
17897
18882
19866
20849
21831
22812
23792
24771
25749
26726
27702
28677
29651
30624
31596
32567
33537
34506
35474
36441
37407
38372
39336
40299
41261
42222
43182
44141
45099
46056
47012
47967
48921
49874
50826
5...

result:

ok 1002 lines

Test #56:

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

input:

1275
1 3 4 5 6 8 9 10 11 12 13 14 16 17 19 22 23 25 30 33 34 35 36 37 39 42 43 46 47 48 49 51 52 53 56 59 61 62 63 64 65 66 67 69 70 71 72 73 75 77 78 79 80 82 84 87 88 89 90 91 93 97 98 100 101 103 104 105 106 107 108 109 110 112 113 117 119 120 121 124 126 130 131 134 135 138 139 140 141 143 144 1...

output:

1
2001
3999
5995
7990
9984
11977
13969
15960
17949
19937
21924
23910
25895
27877
29858
31837
33814
35790
37765
39739
41712
43684
45655
47624
49592
51559
53523
55486
57447
59407
61366
63324
65281
67236
69189
71141
73092
75042
76989
78935
80880
82823
84765
86706
88646
90585
92522
94458
96392
98324
100...

result:

ok 1275 lines

Test #57:

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

input:

1276
1 6 7 8 9 11 12 13 15 18 20 21 22 25 29 31 32 33 36 37 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 56 57 59 61 63 64 65 66 67 68 69 70 72 73 75 76 77 78 80 81 83 84 85 86 88 90 91 93 95 96 97 99 101 103 104 105 109 110 111 112 113 114 116 117 121 122 123 124 126 130 132 134 137 138 139 141 ...

output:

1
2000
3997
5993
7988
9982
11975
13964
15951
17937
19922
21906
23889
25869
27847
29824
31797
33769
35740
37710
39678
41645
43611
45576
47539
49501
51462
53422
55379
57335
59290
61244
63197
65147
67096
69044
70991
72937
74882
76825
78762
80698
82633
84567
86499
88430
90360
92287
94213
96138
98062
999...

result:

ok 1276 lines

Test #58:

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

input:

1271
1 2 3 4 5 7 8 9 10 11 12 13 14 15 16 18 20 21 22 23 25 26 27 29 30 33 34 35 37 38 40 41 45 46 48 49 50 51 52 53 54 55 56 59 64 66 69 74 75 76 78 82 83 85 86 87 88 89 91 92 93 95 96 97 98 102 103 104 105 106 108 110 112 113 115 116 118 119 121 122 123 124 125 126 127 128 135 136 141 143 145 147 ...

output:

1
1999
3996
5992
7987
9981
11974
13965
15955
17944
19930
21914
23896
25876
27849
29821
31791
33760
35727
37693
39657
41617
43576
45533
47488
49440
51389
53336
55282
57227
59171
61112
63052
64989
66924
68858
70791
72723
74654
76584
78513
80441
82368
84294
86219
88141
90062
91982
93898
95813
97727
996...

result:

ok 1271 lines

Test #59:

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

input:

21
1980 1981 1982 1983 1984 1985 1986 1987 1988 1989 1990 1991 1992 1993 1994 1995 1996 1997 1998 1999 2000
1980 1980 1980 1980 1980 1980 1980 1980 1980 1980 1980 1980 1980 1980 1980 1980 1980 1980 1980 1980 1980 1980 1980 1980 1980 1980 1980 1980 1980 1980 1980 1980 1980 1980 1980 1980 1980 1980 19...

output:

1
2001
4000
5998
7995
9991
11986
13980
15973
17965
19956
21946
23935
25923
27910
29896
31881
33865
35848
37830
41790

result:

ok 21 lines

Test #60:

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

input:

1002
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:

1
2001
3002
4002
5001
5999
6996
7992
8987
9981
10974
11966
12957
13947
14936
15924
16911
17897
18882
19866
20849
21831
22812
23792
24771
25749
26726
27702
28677
29651
30624
31596
32567
33537
34506
35474
36441
37407
38372
39336
40299
41261
42222
43182
44141
45099
46056
47012
47967
48921
49874
50826
5...

result:

ok 1002 lines

Test #61:

score: 0
Accepted
time: 2ms
memory: 5384kb

input:

1255
2 4 5 7 8 9 11 12 13 14 17 18 19 23 25 26 27 28 30 33 38 39 41 42 43 44 46 48 49 50 52 55 56 58 59 61 63 66 67 68 71 73 74 76 77 78 79 81 83 84 85 86 88 90 93 95 96 98 100 101 102 103 104 108 109 110 112 113 114 115 117 118 121 122 123 124 125 126 128 129 131 132 133 134 135 136 137 139 142 143...

output:

1
1996
3990
5983
7975
9963
11950
13936
15920
17902
19883
21863
23841
25818
27794
29767
31739
33710
35680
37649
39617
41582
43546
45509
47469
49428
51386
53342
55297
57251
59204
61156
63107
65057
67006
68953
70899
72842
74783
76723
78661
80598
82534
84469
86402
88334
90264
92190
94114
96037
97959
998...

result:

ok 1255 lines

Test #62:

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

input:

1274
2 3 4 5 7 8 9 10 11 12 13 14 16 18 19 21 25 26 27 28 29 30 31 32 34 35 36 37 40 41 44 49 50 52 53 54 55 56 58 59 61 63 65 66 69 71 72 74 76 77 78 79 81 82 83 84 86 87 89 90 91 92 94 95 97 99 100 102 103 105 106 107 108 110 111 112 113 114 116 117 118 119 121 126 127 129 130 131 132 133 135 136 ...

output:

1
2000
3998
5994
7986
9977
11966
13953
15938
17921
19902
21882
23861
25838
27814
29789
31763
33736
35708
37679
39649
41613
43575
45535
47493
49450
51406
53359
55311
57262
59212
61161
63109
65056
67002
68947
70891
72832
74772
76711
78646
80580
82513
84445
86376
88306
90235
92163
94088
96012
97935
998...

result:

ok 1274 lines

Test #63:

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

input:

1262
1 2 3 5 7 9 11 12 13 14 15 18 19 21 22 23 25 26 30 31 33 34 35 36 40 41 42 43 46 47 49 51 52 53 54 55 56 58 59 60 61 62 64 65 68 69 70 72 73 74 76 79 80 81 82 86 87 88 90 92 93 95 98 99 100 102 105 107 108 109 110 112 116 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 1...

output:

1
2001
3999
5993
7986
9978
11969
13959
15948
17936
19922
21907
23891
25873
27854
29834
31813
33790
35765
37739
39712
41684
43654
45623
47591
49558
51523
53486
55446
57405
59363
61320
63276
65231
67185
69138
71090
73037
74983
76928
78872
80815
82757
84698
86638
88577
90513
92447
94379
96310
98239
100...

result:

ok 1262 lines

Test #64:

score: 0
Accepted
time: 2ms
memory: 5388kb

input:

21
1980 1981 1982 1983 1984 1985 1986 1987 1988 1989 1990 1991 1992 1993 1994 1995 1996 1997 1998 1999 2000
1980 1980 1980 1980 1980 1980 1980 1980 1980 1980 1980 1980 1980 1980 1980 1980 1980 1980 1980 1980 1980 1980 1980 1980 1980 1980 1980 1980 1980 1980 1980 1980 1980 1980 1980 1980 1980 1980 19...

output:

1
2001
4000
5998
7995
9991
11986
13980
15973
17965
19956
21946
23935
25923
27910
29896
31881
33865
35848
37830
41790

result:

ok 21 lines

Test #65:

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

input:

1002
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:

1
2001
3002
4002
5001
5999
6996
7992
8987
9981
10974
11966
12957
13947
14936
15924
16911
17897
18882
19866
20849
21831
22812
23792
24771
25749
26726
27702
28677
29651
30624
31596
32567
33537
34506
35474
36441
37407
38372
39336
40299
41261
42222
43182
44141
45099
46056
47012
47967
48921
49874
50826
5...

result:

ok 1002 lines

Test #66:

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

input:

12
1 3 6 10 11 12 15 16 18 19 22 26
22 26 26

output:

1
27
49
68
86
102
117
129
140
150
156
159

result:

ok 12 lines

Test #67:

score: 0
Accepted
time: 2ms
memory: 5400kb

input:

12
6 7 10 15 18 19 20 21 26 27 28 30
27 28 30

output:

1
31
59
86
112
133
153
172
190
205
215
227

result:

ok 12 lines

Test #68:

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

input:

13
1 2 4 7 8 9 12 15 16 19 24 25 30
25 30

output:

1
31
56
80
99
115
130
142
151
159
166
170
172

result:

ok 13 lines

Test #69:

score: 0
Accepted
time: 2ms
memory: 5540kb

input:

10
11 14 19 23 25 26 27 28 29 30
28 29 29 30 30

output:

1
31
60
88
115
141
166
189
208
232

result:

ok 10 lines

Test #70:

score: 0
Accepted
time: 2ms
memory: 5376kb

input:

9
2 4 6 8 10 12 14 15 28
15 15 15 15 15 28

output:

1
29
45
59
71
81
89
95
99

result:

ok 9 lines

Test #71:

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

input:

2000
1048576 1572864 1835008 1966080 2031616 2064384 2080768 2088960 2093056 2095104 2096128 2096640 2096896 2097024 2097088 2097120 2097136 2097144 2097148 2097151 2097152 2097153 2097154 2097155 2097156 2097157 2097158 2097159 2097160 2097161 2097162 2097163 2097164 2097165 2097166 2097167 2097168...

output:

1
2099132
4198262
6297391
8396519
10495646
12594772
14693897
16793021
18892144
20991266
23090387
25189507
27288626
29387744
31486861
33585977
35685092
37784206
39883319
41982431
44081542
46180652
48279761
50378869
52477976
54577082
56676187
58775291
60874394
62973496
65072597
67171697
69270796
71369...

result:

ok 2000 lines

Subtask #5:

score: 0
Skipped

Dependency #1:

0%

Subtask #6:

score: 25
Accepted

Dependency #4:

100%
Accepted

Test #93:

score: 25
Accepted
time: 67ms
memory: 18976kb

input:

500000
1978108 7824448 16070992 19363627 20918674 23178033 25062486 27491435 32227144 32504290 34354868 40619808 40976583 48635411 51084349 53889929 53912053 56144437 56280811 57179147 58706967 63857110 64702507 69761358 70785742 72483776 75420984 75589168 75983614 77306423 79136016 80268561 8058065...

output:

1
999999200709
1999997306637
2999993627388
3999984585621
4999970827115
5999954005317
6999930050082
7999905028756
8999877856676
9999843618343
10999808270402
11999769357750
12999729822932
13999690242568
14999650372476
15999608693274
16999565735989
17999522681429
18999477063941
19999430606175
209993834...

result:

ok 500000 lines

Test #94:

score: 0
Accepted
time: 108ms
memory: 18968kb

input:

499999
5586910 5880966 5988221 7453748 8210486 9637837 9845955 12607215 13222857 15196002 16806993 19073472 19435800 22398623 23058676 25745142 28640649 31095531 31560111 32641211 32942527 34105277 37947784 38585418 40681665 44364412 46050834 56505623 63581399 65902676 68539916 68609445 68956978 692...

output:

1
999999754588
1999997294191
2999990817907
3999984321601
4999970086028
5999951484726
6999932480038
7999912654681
8999892698394
9999871898667
10999850895214
11999827634535
12999804191179
13999777887587
14999750893771
15999720784146
16999690593857
17999660019378
18999627059279
19999589589275
209995460...

result:

ok 499999 lines

Test #95:

score: 0
Accepted
time: 94ms
memory: 18956kb

input:

500000
540353 559702 6020150 6029884 6030524 7472864 8762091 10413019 11558207 12148796 15132490 21742204 25040712 28388392 29502011 29707038 31320851 31528642 31653685 31682303 38146202 38757142 38802274 44622145 44756482 46286003 48024672 48939591 49440250 51466105 53301884 54080477 59275835 59282...

output:

1
999996668163
1999993045602
2999986764818
3999980216028
4999973240590
5999963067500
6999952239327
7999940005065
8999927430315
9999914153003
10999900021740
11999879818147
12999855318944
13999829488627
14999801916972
15999774000316
16999743791508
17999711615336
18999671361312
19999627132338
209995803...

result:

ok 500000 lines

Test #96:

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

input:

21
999999999980 999999999981 999999999982 999999999983 999999999984 999999999985 999999999986 999999999987 999999999988 999999999989 999999999990 999999999991 999999999992 999999999993 999999999994 999999999995 999999999996 999999999997 999999999998 999999999999 1000000000000
999999999980 9999999999...

output:

1
1000000000001
2000000000000
2999999999998
3999999999995
4999999999991
5999999999986
6999999999980
7999999999973
8999999999965
9999999999956
10999999999946
11999999999935
12999999999923
13999999999910
14999999999896
15999999999881
16999999999865
17999999999848
18999999999830
20999999999790

result:

ok 21 lines

Test #97:

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

input:

250002
2000000 4000000 6000000 8000000 10000000 12000000 14000000 16000000 18000000 20000000 22000000 24000000 26000000 28000000 30000000 32000000 34000000 36000000 38000000 40000000 42000000 44000000 46000000 48000000 50000000 52000000 54000000 56000000 58000000 60000000 62000000 64000000 66000000 ...

output:

1
1000000000001
1500002000001
2000002000001
2500000000001
2999996000001
3499990000001
3999982000001
4499972000001
4999960000001
5499946000001
5999930000001
6499912000001
6999892000001
7499870000001
7999846000001
8499820000001
8999792000001
9499762000001
9999730000001
10499696000001
10999660000001
11...

result:

ok 250002 lines

Test #98:

score: 0
Accepted
time: 95ms
memory: 18948kb

input:

500000
1313720 3941025 4207370 4904501 6053618 10592322 16996088 17198284 17389792 18019167 18888100 20478954 24636782 25201933 26238348 28501741 30277788 32025287 32906338 34540324 36375442 37157153 38022247 40739813 42788062 44679215 48781996 50462617 52695173 61234928 62811656 63848753 64031351 6...

output:

1
999997394023
1999990350606
2999982933470
3999970383998
4999953964550
5999933811984
6999909813419
7999880652792
8999845841981
9999810947831
10999768568770
11999721748772
12999669843283
13999617589090
14999564882744
15999512011192
16999452838515
17999393653102
18999331390891
19999267818378
209992028...

result:

ok 500000 lines

Test #99:

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

input:

500000
491817 2153389 2295775 2852054 4302695 11078932 15771771 17578489 18115437 21489574 22134893 26950958 29406165 31116633 31529979 34061760 34595010 39303612 39702679 40764367 40787130 40873244 41262848 41733183 42282913 44790918 52616580 56625119 57449110 58200218 59360637 60642265 64841890 69...

output:

1
999996657825
1999991318209
2999984688728
3999977247256
4999965741711
5999954194282
6999941024197
7999924026842
8999906963220
9999887261415
10999865637860
11999843168440
12999820553967
13999790839568
14999761119076
15999731119826
16999701006978
17999670257997
18999634678955
19999597571200
209995555...

result:

ok 500000 lines

Test #100:

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

input:

500000
706676 2396847 5939575 6091149 10874963 11656758 18114939 18833067 21015238 28459264 28583711 29149920 31162158 32854979 36874869 37662987 37668736 37999840 38205607 40149017 48544349 50736545 50904667 56768539 57983962 58926899 60255236 60548868 63433985 70454810 71588575 72568947 74842794 7...

output:

1
999996896533
1999991795893
2999985218636
3999978313570
4999970402120
5999960857217
6999946955801
7999931877180
8999916506976
9999900680420
10999884831112
11999867067040
12999849178946
13999830301099
14999809891941
15999781932899
16999749901100
17999717610527
18999681474021
19999642615132
209996021...

result:

ok 500000 lines

Test #101:

score: 0
Accepted
time: 2ms
memory: 5536kb

input:

21
999999999980 999999999981 999999999982 999999999983 999999999984 999999999985 999999999986 999999999987 999999999988 999999999989 999999999990 999999999991 999999999992 999999999993 999999999994 999999999995 999999999996 999999999997 999999999998 999999999999 1000000000000
999999999980 9999999999...

output:

1
1000000000001
2000000000000
2999999999998
3999999999995
4999999999991
5999999999986
6999999999980
7999999999973
8999999999965
9999999999956
10999999999946
11999999999935
12999999999923
13999999999910
14999999999896
15999999999881
16999999999865
17999999999848
18999999999830
20999999999790

result:

ok 21 lines

Test #102:

score: 0
Accepted
time: 37ms
memory: 15344kb

input:

250002
2000000 4000000 6000000 8000000 10000000 12000000 14000000 16000000 18000000 20000000 22000000 24000000 26000000 28000000 30000000 32000000 34000000 36000000 38000000 40000000 42000000 44000000 46000000 48000000 50000000 52000000 54000000 56000000 58000000 60000000 62000000 64000000 66000000 ...

output:

1
1000000000001
1500002000001
2000002000001
2500000000001
2999996000001
3499990000001
3999982000001
4499972000001
4999960000001
5499946000001
5999930000001
6499912000001
6999892000001
7499870000001
7999846000001
8499820000001
8999792000001
9499762000001
9999730000001
10499696000001
10999660000001
11...

result:

ok 250002 lines

Test #103:

score: 0
Accepted
time: 84ms
memory: 18972kb

input:

500000
10501477 10924407 11370522 11593201 12652776 12869274 13024695 13754669 19405071 22941205 23919636 28665808 30339415 32882781 35001386 35524645 36399974 38653067 41322258 45314672 45798511 48909106 49471875 50916418 52928946 53799954 54405111 55711151 60441306 61181170 62217043 65050874 66808...

output:

1
999999992051
1999999200342
2999996502038
3999993721760
4999989702960
5999984449515
6999976015043
7999960365094
8999940055820
9999914668979
10999887671158
11999858774122
12999827868161
13999795707222
14999762824010
15999727771059
16999690879522
17999652084708
18999611097971
19999568405797
209995208...

result:

ok 500000 lines

Test #104:

score: 0
Accepted
time: 120ms
memory: 18952kb

input:

500000
402450 775089 7082371 10448535 13978966 14835299 15350740 17905571 18524584 19530906 20444925 24018945 35745881 36809328 39186091 40052728 42268000 45627168 46674883 47393140 48468990 52900515 55288420 55498843 55726922 57541014 58736292 60666089 61964196 65652042 66176080 72294017 72760941 7...

output:

1
999993742319
1999985828511
2999975521287
3999964556276
4999953443129
5999940786925
6999926947416
7999912647974
8999896054691
9999878168520
10999859200584
11999837182888
12999812342376
13999784957861
14999754285459
15999723489141
16999688841269
17999649839510
18999609199664
19999566359996
209995220...

result:

ok 500000 lines

Test #105:

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

input:

500000
546907 7045232 11273471 15788418 19622729 28229833 29989141 30026641 34382744 34728132 36160401 42357661 42482308 44697382 47749789 50616327 52939930 53568045 57126272 60981293 65083396 67265051 67516963 69406747 71704358 77092667 82494200 86645825 86730955 88255007 91285423 93875995 95213801...

output:

1
999999325656
1999998288679
2999994551153
3999990507943
4999975417981
5999956194650
6999935524447
7999914839599
8999893241228
9999866865082
10999838672176
11999808879496
12999778290481
13999744089930
14999707965815
15999671381464
16999628760928
17999585308448
18999540880823
19999493032737
209994445...

result:

ok 500000 lines

Test #106:

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

input:

21
999999999980 999999999981 999999999982 999999999983 999999999984 999999999985 999999999986 999999999987 999999999988 999999999989 999999999990 999999999991 999999999992 999999999993 999999999994 999999999995 999999999996 999999999997 999999999998 999999999999 1000000000000
999999999980 9999999999...

output:

1
1000000000001
2000000000000
2999999999998
3999999999995
4999999999991
5999999999986
6999999999980
7999999999973
8999999999965
9999999999956
10999999999946
11999999999935
12999999999923
13999999999910
14999999999896
15999999999881
16999999999865
17999999999848
18999999999830
20999999999790

result:

ok 21 lines

Test #107:

score: 0
Accepted
time: 28ms
memory: 14352kb

input:

250002
2000000 4000000 6000000 8000000 10000000 12000000 14000000 16000000 18000000 20000000 22000000 24000000 26000000 28000000 30000000 32000000 34000000 36000000 38000000 40000000 42000000 44000000 46000000 48000000 50000000 52000000 54000000 56000000 58000000 60000000 62000000 64000000 66000000 ...

output:

1
1000000000001
1500002000001
2000002000001
2500000000001
2999996000001
3499990000001
3999982000001
4499972000001
4999960000001
5499946000001
5999930000001
6499912000001
6999892000001
7499870000001
7999846000001
8499820000001
8999792000001
9499762000001
9999730000001
10499696000001
10999660000001
11...

result:

ok 250002 lines

Test #108:

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

input:

500000
1048576 1572864 1835008 1966080 2031616 2064384 2080768 2088960 2093056 2095104 2096128 2096640 2096896 2097024 2097088 2097120 2097136 2097144 2097148 2097151 2097152 2097153 2097154 2097155 2097156 2097157 2097158 2097159 2097160 2097161 2097162 2097163 2097164 2097165 2097166 2097167 20971...

output:

1
2597132
5194262
7791391
10388519
12985646
15582772
18179897
20777021
23374144
25971266
28568387
31165507
33762626
36359744
38956861
41553977
44151092
46748206
49345319
51942431
54539542
57136652
59733761
62330869
64927976
67525082
70122187
72719291
75316394
77913496
80510597
83107697
85704796
8830...

result:

ok 500000 lines

Subtask #7:

score: 0
Skipped

Dependency #1:

0%