QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#302369#7615. Sequence Foldingdefyers#AC ✓15ms9428kbC++201.6kb2024-01-10 20:02:542024-01-10 20:02:55

Judging History

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

  • [2024-01-10 20:02:55]
  • 评测
  • 测评结果:AC
  • 用时:15ms
  • 内存:9428kb
  • [2024-01-10 20:02:54]
  • 提交

answer

#include "bits/stdc++.h"

using namespace std;

#pragma GCC optimize("Ofast")
#pragma GCC target("avx2")

using ll = long long;
using LL = long long;
using pii = pair<int, int>;

LL n, m;
LL ans;

void f(LL n, vector<pair<LL, int>> &v) {
	if (n == 1) return;
	
	vector<pair<LL, int>> v2;
	LL n2 = n / 2;
	int p1 = 0;
	int p2 = (int)v.size() - 1;
	while (p1 <= p2) {
		LL dis1 = n2 - v[p1].first;
		LL dis2 = v[p2].first - (n2 + 1);
		if (dis1 == dis2) {
			if (v[p1].second == v[p2].second) {
				v2.push_back(v[p1]);
			}
			else if (v[p1].second == 2) {
				v2.push_back({v[p1].first, v[p2].second});
			}
			else if (v[p2].second == 2) {
				v2.push_back(v[p1]);
			}
			else {
				v2.push_back({v[p1].first, 2});
				ans++;
			}
			p1++;
			p2--;
		}
		else if (dis1 > dis2) {
			if(v[p1].second == 1){
				ans++;
				v2.push_back({v[p1].first, 2});
			}
			else if (v[p1].second == 2) {
				v2.push_back({v[p1].first, 0});
			}
			else {

			}
			p1++;
		}
		else {
			LL pl = n2 - dis2;
			if (v[p2].second == 1) {
				ans++;
				v2.push_back({pl, 2});
			}
			else if (v[p2].second == 2) {
				v2.push_back({pl, 0});
			}
			else {

			}
			p2--;
		}
	}
	f(n2, v2);
}
void solve(int TC) {
	cin >> n >> m;
	vector<pair<LL, int>> v;
	ans = 0;
	for (int i = 1; i <= m; i++) {
		LL tmp;
		cin >> tmp;
		v.push_back({tmp, 1});
	}
	f(n, v);
	cout << ans << "\n";
	return;
}

int32_t main() {
	cin.tie(0)->sync_with_stdio(0);
	cout << fixed << setprecision(10);

	int t = 1;
	//cin >> t;
	for (int i = 1; i <= t; i++) {
		solve(i);
	}
}

详细

Test #1:

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

input:

8 3
1 5 8

output:

2

result:

ok single line: '2'

Test #2:

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

input:

1 1
1

output:

0

result:

ok single line: '0'

Test #3:

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

input:

17179869184 100000
138476 774165 993977 1152277 1236393 1244970 1534017 1693701 1763926 1778781 1842066 1874644 1885666 2120429 2485344 2977941 3158255 3340476 3504862 4000117 4066652 4197639 4338723 4389163 4576965 4761601 5097091 5175412 5295902 5810551 5855982 6001770 6111262 6163309 6351547 6582...

output:

99999

result:

ok single line: '99999'

Test #4:

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

input:

549755813888 100000
16886305 20807233 27844305 30727441 30898344 35755457 38085835 43336454 47877882 50347884 53237225 53718183 60030541 66954859 80773500 82511603 84025040 86398615 93070876 94502940 98906398 100677488 103720017 105522694 116741042 122492007 135222584 155167916 160926866 166110647 1...

output:

100000

result:

ok single line: '100000'

Test #5:

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

input:

17592186044416 100000
44842545 229248515 253567434 347949154 349195610 404810585 639421407 650796923 1019260054 1250861689 1315840401 1318619991 1339387462 1388173647 1406074815 1459749263 1707998226 1902480662 2060860604 2075157570 2410720375 2589192480 2742051226 2784829021 3019629868 3194189913 3...

output:

100000

result:

ok single line: '100000'

Test #6:

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

input:

562949953421312 100000
8468403039 19260915102 24550792804 45571277635 47757798888 50487845666 53656890708 58778712483 63838097144 65697633747 74717895118 75607193564 75790076603 82739180544 88493216722 90960251492 93191423725 93775335122 96870622706 97818052601 107098516035 116573978680 117388104977...

output:

100000

result:

ok single line: '100000'

Test #7:

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

input:

18014398509481984 100000
595466408158 695142884370 811588821663 938951385045 955148012821 1074515190235 1209454535782 1319295844076 1465300774125 1634202068435 1761189966958 2474372766317 2493877995320 2532743464849 2607093321941 2755490217777 3183921545337 3499339208003 3649317240659 3873577127103 ...

output:

100000

result:

ok single line: '100000'

Test #8:

score: 0
Accepted
time: 14ms
memory: 9352kb

input:

576460752303423488 100000
13970345269592 15376826852028 24802122999858 27223268306434 36702541028981 43837014560573 44921933577642 58096934157757 59667447677923 66975875846281 84770936584661 86367511887665 89865085383436 91951807720175 103815897231785 104261045426912 107706410045438 108769878131800 ...

output:

100000

result:

ok single line: '100000'

Test #9:

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

input:

65536 65536
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 ...

output:

0

result:

ok single line: '0'

Test #10:

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

input:

131072 100000
1 2 4 5 6 9 11 12 14 15 17 18 19 21 22 23 24 26 28 30 31 32 33 34 37 39 40 41 43 44 45 46 47 48 49 51 52 53 54 55 56 57 61 62 64 65 66 67 68 69 70 72 73 74 75 76 77 78 80 81 82 83 84 85 86 87 88 89 90 91 92 93 96 97 98 100 102 103 104 105 106 107 108 109 110 111 112 113 115 116 117 118...

output:

27315

result:

ok single line: '27315'

Test #11:

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

input:

131072 35791
1 3 4 7 10 12 16 18 27 33 41 51 54 63 68 69 85 93 94 100 101 103 105 109 113 114 115 117 118 123 129 132 135 137 139 141 144 146 150 152 153 161 165 170 172 175 177 179 192 195 196 197 201 202 205 207 208 210 212 213 217 218 225 228 229 236 239 242 256 259 265 270 273 285 295 297 299 30...

output:

30694

result:

ok single line: '30694'

Test #12:

score: 0
Accepted
time: 5ms
memory: 5508kb

input:

131072 53908
4 6 12 13 14 16 20 23 24 31 33 35 37 39 40 42 46 47 48 52 53 55 57 58 60 61 62 66 68 69 75 79 80 81 82 83 87 90 94 95 97 98 100 103 105 106 107 109 110 111 112 117 120 123 127 128 131 132 138 146 147 148 154 155 159 161 163 164 168 171 172 173 174 177 178 179 181 183 187 188 189 190 192...

output:

40848

result:

ok single line: '40848'

Test #13:

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

input:

2 1
2

output:

1

result:

ok single line: '1'

Test #14:

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

input:

262144 100000
3 6 10 12 23 27 30 31 32 35 36 38 39 40 43 44 45 47 49 50 51 52 54 55 60 62 66 68 69 70 71 73 77 79 80 81 82 86 88 91 94 95 98 100 101 102 107 109 113 123 125 126 127 128 131 132 138 142 144 146 147 149 150 151 156 157 166 167 169 170 171 174 176 177 181 184 188 190 195 197 198 203 204...

output:

78358

result:

ok single line: '78358'

Test #15:

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

input:

262144 100000
4 6 8 13 16 18 19 20 21 27 28 32 36 37 38 42 44 47 51 53 55 56 61 62 65 66 68 80 81 82 84 85 88 89 90 92 96 110 112 113 114 117 118 121 123 124 127 129 131 133 136 137 140 142 152 153 156 161 162 163 164 167 174 176 177 178 182 183 188 190 192 194 195 198 200 207 208 210 211 212 214 21...

output:

78283

result:

ok single line: '78283'

Test #16:

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

input:

262144 100000
8 13 17 18 24 25 28 33 42 43 45 47 49 53 63 65 67 68 69 71 75 80 81 82 91 98 99 100 101 107 109 110 113 114 115 118 119 121 125 128 129 131 133 136 142 145 147 148 149 150 151 153 161 167 168 169 171 174 175 176 178 185 187 188 190 192 193 195 197 198 200 202 203 205 206 207 211 223 22...

output:

78377

result:

ok single line: '78377'

Test #17:

score: 0
Accepted
time: 14ms
memory: 9376kb

input:

288230376151711744 100000
2051253087133 5034791117487 16277884254216 18748708512249 25161273356777 36308675496739 36396901330480 36762586969507 37497387695665 37563665735752 39576584265761 41873710679871 49534817047754 53927300913267 54227259634409 56761933827487 57956114073060 63040701064548 641255...

output:

100000

result:

ok single line: '100000'

Test #18:

score: 0
Accepted
time: 14ms
memory: 9376kb

input:

288230376151711744 100000
13673747777668 15739859999866 21203445973142 23798904995363 26158220623088 28986290989623 33184712388237 35166671949347 36281038226194 41488068526902 47701082448077 63719553846332 64908694760680 73471939044692 73685979018933 75730004826420 81098014344469 81935325531771 8353...

output:

100000

result:

ok single line: '100000'

Test #19:

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

input:

288230376151711744 100000
595301495104 1718356412302 3503997570218 5034929023689 5044869417779 9078189744121 12507129448076 13515421734092 14995690016321 17184354842267 18805440477175 19403492814747 20651814136440 21836850228253 24681339065751 26416497021478 27195137574686 28473163660886 30072237858...

output:

100000

result:

ok single line: '100000'

Test #20:

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

input:

576460752303423488 100000
8107391531049 8397412343932 11817015312495 18591269865678 24476561473901 29556407820988 34956326024323 37463753731130 42304557847636 47883181462463 48668327829946 49181951408615 75388508288926 83647541308487 86526892361219 91560373134632 99258585092530 99439609915249 108353...

output:

100000

result:

ok single line: '100000'

Test #21:

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

input:

576460752303423488 100000
1388353887417 1565068348341 20461475046307 20808040783771 42262646665379 44452317030462 50311328008597 52632832423156 55287465462393 56822211676307 57465304610020 59928313328138 60749421163438 69204165591640 74148897147158 81829481137874 81855180888972 82832964869916 857539...

output:

100000

result:

ok single line: '100000'

Test #22:

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

input:

576460752303423488 100000
299412255631 5700704493184 10374640508969 12676997555789 14512812190840 23825590796082 28243772166098 37676718146017 38624523175525 47347897432412 53549672404802 65560500188236 68505011765890 69303909362599 73610277218696 76205159984856 79970846507950 80248430954621 8242864...

output:

100000

result:

ok single line: '100000'

Test #23:

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

input:

1073741824 100000
7047 15239 17530 33914 48007 50298 80775 83066 97159 113543 115834 124026 138119 146311 148602 164986 179079 181370 211847 214138 228231 244615 246906 255098 269191 277383 279674 296058 310151 312442 342919 345210 359303 361594 375687 377978 386170 400263 408455 410746 427130 44122...

output:

13

result:

ok single line: '13'

Test #24:

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

input:

2 2
1 2

output:

0

result:

ok single line: '0'

Test #25:

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

input:

1073741824 100000
11062 15697 21707 33456 49840 54475 76598 81233 92982 97617 115376 120011 142134 146769 164528 169163 180912 185547 207670 212305 228689 240438 246448 251083 273206 277841 295600 300235 311984 316619 338742 355126 359761 361136 377520 382155 404278 408913 426672 431307 443056 44769...

output:

24

result:

ok single line: '24'

Test #26:

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

input:

1073741824 100000
6505 7059 8678 10885 20167 26895 30989 36550 65229 90598 104178 112506 120188 124568 131380 171547 194829 225595 235250 241978 243578 251260 255086 255640 268649 269203 273029 280711 282311 289039 298694 329460 340282 345198 352742 364230 392909 393524 411783 433691 456973 459060 4...

output:

90

result:

ok single line: '90'

Test #27:

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

input:

1073741824 100000
4631 6834 8373 32781 33971 38739 40766 51539 63378 63647 95366 95522 96988 106293 109527 116616 121392 121774 127876 132110 141593 145704 169625 174333 220596 240067 254379 260831 273328 289832 289937 299226 328111 336206 337719 340223 342687 358454 363871 369338 386587 401980 4063...

output:

776

result:

ok single line: '776'

Test #28:

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

input:

288230376151711744 99911
2658919856233 6137173165976 7056966367337 10535219677080 11455012878441 14933266188184 19331312699288 20251105900649 24649152411753 28127405721496 29047198922857 32525452232600 37843291945065 41321545254808 42241338456169 45719591765912 50117638277016 51037431478377 55435477...

output:

12

result:

ok single line: '12'

Test #29:

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

input:

288230376151711744 100000
2286821018261 3031678743290 10162460790023 10907318515052 14560507301127 15305365026156 19879007062677 24277053573781 25021911298810 27754646834439 32152693345543 32897551070572 37471193107093 38216050832122 41869239618197 42614097343226 45346832878855 46091690603884 550633...

output:

25

result:

ok single line: '25'

Test #30:

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

input:

288230376151711744 99992
3887306956759 5667793997091 6734020939233 7996262134232 8283892221528 11303784604630 11955237713501 23916845378709 29516578091742 30232914125101 31297065132074 35123618447825 40135830052564 41472773528619 46451898798956 51976727245272 52264357332568 58413506464164 5910121746...

output:

100

result:

ok single line: '100'

Test #31:

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

input:

288230376151711744 100000
1663133533299 3681452084442 4345931629336 5515830866121 5636534637589 8478697414161 13880107686790 18506006603919 20611856370858 21510200190809 22277255025510 30175984953993 35675816280939 36691379392050 40239093273107 43213465389412 52628559569586 59805776045279 6050580881...

output:

750

result:

ok single line: '750'

Test #32:

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

input:

576460752303423488 99950
2068680637308 4528389129349 13063796915068 13324482151557 21859889937276 22120575173765 30655982959484 39712761218181 48248169003900 48508854240389 57044262026108 57304947262597 65840355048316 74897133307013 83432541092732 83693226329221 92228634114940 92489319351429 1010247...

output:

11

result:

ok single line: '11'

Test #33:

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

input:

576460752303423488 100000
1027050019700 4191018623714 24116794202996 26181251179234 30993353465119 34157322069133 36211422108532 44187492998431 46251949974669 61365623268066 66177725553951 69341694157965 71395794197364 74559762801378 79371865087263 94485538380660 96549995356898 104526066246797 10658...

output:

22

result:

ok single line: '22'

Test #34:

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

input:

576460752303423488 100000
802776450308 2729783637460 3431614090187 26211194891525 26418307174429 32455951018620 33249960142700 44106473047751 52935831928290 66374284741141 72303156123797 73097165247877 74363203614188 79341921374972 87801656427039 94261264811268 95088760370644 96631015307578 11431918...

output:

102

result:

ok single line: '102'

Test #35:

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

input:

16 2
11 12

output:

2

result:

ok single line: '2'

Test #36:

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

input:

576460752303423488 100000
17672222909172 20905919970582 24345253439514 27712944078234 38957780848058 52997583154216 59759825785886 68507830186116 69202527349155 73422677261762 77517671238577 78400706977784 81075273407084 81255660091061 83434122659300 89844409113616 97746386992109 101465685608196 109...

output:

765

result:

ok single line: '765'

Test #37:

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

input:

33554432 99950
351 701 1033 1932 2040 2479 2505 2649 3064 3081 4569 4825 5112 5337 5401 5721 5800 6025 6153 6281 6681 7416 7464 7664 7672 7720 7760 8056 8281 8696 8872 9225 9332 10024 10249 10920 11225 11273 11504 11768 12024 12169 13304 13657 14033 14968 15352 15528 15720 15992 16137 16209 16221 16...

output:

85321

result:

ok single line: '85321'

Test #38:

score: 0
Accepted
time: 5ms
memory: 9108kb

input:

33554432 100000
152 179 356 1381 1559 2234 2327 2538 2666 3255 3543 3607 3876 4586 5789 6364 6429 6500 6634 7500 7703 7868 8260 8852 9464 9636 9706 9751 10461 10596 11297 11453 11933 12087 12092 12771 13165 13642 13668 14206 14692 15139 15204 15248 16471 16653 16740 17060 17076 17165 17181 18679 190...

output:

87313

result:

ok single line: '87313'

Test #39:

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

input:

33554432 100000
162 373 584 1236 1849 2354 2777 2799 3151 3189 3385 3466 3791 4257 4389 4469 4601 5260 5711 5909 6856 6984 7106 7160 7208 7311 7474 7558 7602 7759 7880 8167 8218 9138 9786 10101 10193 10266 10405 11125 11602 12111 12722 12935 13000 13082 13362 13768 14252 14759 15026 15034 15865 1635...

output:

88318

result:

ok single line: '88318'

Test #40:

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

input:

33554432 99993
179 339 461 1091 1400 1556 1778 1960 2643 2950 3100 3176 3519 3551 3554 3650 4155 4179 4835 5032 5726 5736 5800 6459 6553 7109 7137 7141 7615 8005 8064 8222 8515 8675 9194 9256 9957 10015 11166 12584 13224 13246 13285 14651 14745 15260 15607 15821 16180 16871 16979 17222 17381 17628 1...

output:

89380

result:

ok single line: '89380'

Test #41:

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

input:

33554432 100000
21 496 574 754 937 1340 1438 1522 1819 2753 2819 3128 3482 3582 4646 5416 5623 5791 6133 6682 7183 7205 7244 7521 7713 7790 8052 8558 9422 9451 9802 10039 10152 10298 10514 10578 11139 11163 11281 11421 11762 12198 12540 13213 13292 13583 14095 14098 14760 15025 15080 15885 16045 164...

output:

91460

result:

ok single line: '91460'

Test #42:

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

input:

2147483648 99932
821 2397 18741 33996 42533 47925 52428 81069 126156 133772 183852 186165 193333 195276 300172 319075 329525 356967 366517 381437 388300 398133 412876 439093 463669 468052 490095 494796 555477 576716 637133 650444 659852 660757 671285 684122 686517 693045 707788 735468 742229 748748 ...

output:

91152

result:

ok single line: '91152'

Test #43:

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

input:

2147483648 99981
27491 37346 84707 94714 97319 102882 149023 196109 212702 328990 330655 339487 427294 439582 510046 536095 545250 564963 568035 611459 624024 684063 700019 716319 742686 745437 753461 753479 758242 772835 779807 796959 807394 832798 833406 840798 877538 945695 963870 1004575 1032510...

output:

91541

result:

ok single line: '91541'

Test #44:

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

input:

2147483648 100000
3956 34676 63279 84330 88106 96215 145618 174039 185706 198866 231634 243562 275154 314221 317258 346989 359592 446605 456495 481332 531309 575530 587567 592082 601972 611799 612394 624850 660946 723154 733044 784525 816943 828564 849309 861332 864116 872490 899949 911620 914669 93...

output:

92187

result:

ok single line: '92187'

Test #45:

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

input:

2147483648 100000
20252 42597 63175 64826 123841 130890 157925 192287 208102 215127 349312 410853 410938 411122 421705 449059 497028 541286 569410 614335 623846 674880 688191 693895 702353 719643 768637 775984 779201 831554 860224 874952 906679 920806 924736 977008 1026634 1057709 1070519 1089400 11...

output:

92434

result:

ok single line: '92434'

Test #46:

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

input:

512 26
12 27 48 52 65 79 132 143 151 154 196 228 237 240 264 278 367 406 407 424 453 457 485 503 508 511

output:

26

result:

ok single line: '26'

Test #47:

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

input:

2147483648 100000
4356 14077 40323 112972 133335 163151 176621 197786 232615 245595 248538 260851 316862 345857 354194 372477 373309 391424 394168 395544 398326 423478 435011 436928 450960 473534 500668 512692 517268 580545 581399 589832 590588 592324 597617 611977 707971 724189 739456 758416 768577...

output:

93898

result:

ok single line: '93898'

Test #48:

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

input:

1099511627776 99984
8533904 19216272 25020529 25938033 27969649 49952656 73404496 119945104 121489521 127301153 138876816 144558193 145344625 146589809 146945936 150302608 159238257 163723152 178829200 188115057 198588304 214054800 220792945 228444273 232010640 252589968 265435024 271464336 30852926...

output:

94034

result:

ok single line: '94034'

Test #49:

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

input:

1099511627776 100000
5328157 12980964 17668112 20361956 51237604 68309945 80301341 116751496 132730141 133530489 134644601 140131464 144653448 152665224 153237305 161760121 173179769 214519069 252386717 254325476 254519357 269579716 306793757 323570973 334933668 359563385 363691144 381058184 3886621...

output:

94327

result:

ok single line: '94327'

Test #50:

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

input:

1099511627776 100000
8827636 18905919 29148922 44119140 77001881 78765528 97486018 150778729 165655652 187726655 195102365 197151645 198271529 211831709 220181604 229669695 229863906 238657727 239055972 276048066 283340863 286749181 287793705 290229791 296972770 307007007 316885090 349144258 3732737...

output:

94602

result:

ok single line: '94602'

Test #51:

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

input:

1099511627776 99960
30478018 31483647 31869063 34906887 36908311 42440962 53123330 73076064 86369986 86958144 96356487 97633625 101140136 107023712 120898882 128850239 145016130 154159875 159881474 168330384 168594830 171400544 175523975 180279745 182383265 186620162 191204750 202842049 218428065 22...

output:

94810

result:

ok single line: '94810'

Test #52:

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

input:

1099511627776 100000
4747171 6603448 26783738 42170195 43908405 67412075 90137326 94731073 105026869 126764480 134354636 135237726 159251321 166940540 177669256 181899358 183008654 213314777 219946912 241688229 262288898 266034835 289170799 294798816 302881017 303489116 316698070 324581346 343885639...

output:

95723

result:

ok single line: '95723'

Test #53:

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

input:

1125899906842624 100000
9535856124 9950812412 10689077765 26247463429 33413816837 46298718725 50044444156 67370902021 85133582853 86005752325 86832472581 89894264316 93312672261 93543358981 95435202044 99219302917 100625513727 127903097349 129708957180 138150492677 179442704901 200380670469 21487618...

output:

95822

result:

ok single line: '95822'

Test #54:

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

input:

1125899906842624 99918
9249719304 15094095147 36200102905 70435881992 71935672406 86592537302 100993441067 105584827691 109828785160 126377045760 127406021931 128165503702 139056701349 152533048619 155206476591 155882682667 156510890160 158415602696 177518340395 178213652488 187294661625 20276403332...

output:

95756

result:

ok single line: '95756'

Test #55:

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

input:

1125899906842624 99922
6051324715 8873242871 29148575555 40089092207 42004095223 42173842671 55289290999 67173001932 101606898450 106611925803 117720474411 129327723794 131614860075 171022861551 184813501202 217323092754 227471526078 260224846014 265333634883 268826582230 280540077522 284130517239 2...

output:

95989

result:

ok single line: '95989'

Test #56:

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

input:

1125899906842624 100000
12794618472 16164739491 20914802867 28773017980 44866221588 53638762675 73199884732 80716363328 82708395584 85627094883 116505246726 132133650693 132545415232 156206272691 156335628904 163701261829 165172594531 194409232892 198650735435 210116039862 210518303336 216576988805 ...

output:

96253

result:

ok single line: '96253'

Test #57:

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

input:

16384 13855
1 3 4 6 7 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 53 54 55 56 57 59 60 61 62 63 64 65 66 68 69 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 102 103 104 105 106 107...

output:

2299

result:

ok single line: '2299'

Test #58:

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

input:

1125899906842624 99934
1886306321 8581936543 21394056027 26460994734 120438875845 125719896378 139767701332 143489315117 149382932471 177476987936 196819164297 207944551121 209056779163 216559661182 232354329418 237573895745 245505152605 260506257514 291263788151 293840626044 304804517434 3066061274...

output:

96728

result:

ok single line: '96728'

Test #59:

score: 0
Accepted
time: 14ms
memory: 9392kb

input:

576460752303423488 99961
5782261419595 6552884654518 11363248026038 12313693729206 17545023409739 20569431166539 22034417667659 29812603440715 34696133525067 38614392549814 38637296856302 45742637141579 54589736661430 56276727673270 56549365730891 73711464173131 76498040213067 80331832865206 8441881...

output:

96538

result:

ok single line: '96538'

Test #60:

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

input:

576460752303423488 100000
1495393798437 4655357495589 16509578524380 16966442699542 30602387163429 30903827909398 39766357014236 45339114097430 62931300141846 68428858280726 69085294135589 72308630074603 83443777203606 110135101191900 112433214147350 117348878365931 124378703104293 132400211654364 1...

output:

96649

result:

ok single line: '96649'

Test #61:

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

input:

576460752303423488 99945
4561589512071 19477820576833 29132294848065 35129629065225 37327219146744 38372512283993 38538012803064 39910672152354 57986687707015 68125895922753 72475794220935 98418763262912 102599407987236 105499693659201 106269875868737 114305375172386 119217436213257 140910446113890 ...

output:

96809

result:

ok single line: '96809'

Test #62:

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

input:

576460752303423488 99992
1575655125190 2845991601922 5624848963330 8012872269833 14613774858495 14764325485633 32849963338932 34569881122107 37953525497865 38818654157106 39087152009693 41195263036109 52417345627609 58044429546317 61443553884466 62531607293689 69523736117240 70626938893133 821654313...

output:

96890

result:

ok single line: '96890'

Test #63:

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

input:

576460752303423488 100000
18995934100355 21113705478149 23481871169936 28364308458092 30801139234467 30863274017773 34854205650668 51326551243990 58729152049919 59361999164310 71337504882501 72972562425605 80101282220652 85826471821886 86064488344751 89518833070847 92434235713382 98277462449480 1052...

output:

97362

result:

ok single line: '97362'

Test #64:

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

input:

576460752303423488 65536
1 17592186044416 17592186044417 35184372088832 35184372088833 52776558133248 52776558133249 70368744177664 70368744177665 87960930222080 87960930222081 105553116266496 105553116266497 123145302310912 123145302310913 140737488355328 140737488355329 158329674399744 15832967439...

output:

1

result:

ok single line: '1'

Test #65:

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

input:

576460752303423488 87381
1 8796093022208 17592186044416 17592186044417 26388279066625 35184372088832 35184372088833 52776558133248 52776558133249 61572651155457 70368744177664 70368744177665 79164837199872 87960930222080 87960930222081 105553116266496 105553116266497 114349209288704 123145302310912 ...

output:

9

result:

ok single line: '9'

Test #66:

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

input:

576460752303423488 98303
1 8796093022208 17592186044416 17592186044417 26388279066625 35184372088832 35184372088833 43980465111040 52776558133248 52776558133249 61572651155457 70368744177664 70368744177665 79164837199872 87960930222080 87960930222081 96757023244289 105553116266496 105553116266497 11...

output:

3

result:

ok single line: '3'

Test #67:

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

input:

576460752303423488 100000
1 8796093022208 8796093022209 17592186044416 17592186044417 26388279066625 35184372088832 35184372088833 43980465111040 52776558133248 52776558133249 61572651155457 70368744177664 70368744177665 79164837199872 87960930222080 87960930222081 96757023244289 105553116266496 105...

output:

6

result:

ok single line: '6'

Test #68:

score: 0
Accepted
time: 5ms
memory: 9072kb

input:

524288 100000
11 12 14 21 36 37 43 47 52 54 71 73 74 76 77 78 81 84 86 88 93 115 118 120 126 129 132 138 141 143 144 145 154 158 160 182 187 192 207 209 210 211 213 221 226 229 230 232 236 240 241 244 248 252 266 270 281 288 289 292 297 299 303 321 322 323 327 328 331 335 340 349 350 358 383 391 396...

output:

90248

result:

ok single line: '90248'

Test #69:

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

input:

16777216 75025
187 1007 1347 1443 1539 1938 2207 2342 2438 2630 2863 2907 3142 3579 3583 3602 3659 3838 4163 4286 4479 5051 5090 5307 5467 5643 5679 6518 6546 6726 7230 7646 8175 8210 8495 8702 8850 9087 9142 9339 9667 11234 11426 11451 11766 12130 13311 14043 14447 14475 14590 14726 15727 15842 158...

output:

46368

result:

ok single line: '46368'

Test #70:

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

input:

8388608 46368
20 321 400 445 449 632 649 701 708 1204 1409 1673 1848 2029 2040 2112 2253 2484 2505 2644 2897 2948 2992 3140 3773 3881 3988 4721 4740 5040 5184 5505 5648 5745 5769 5777 5940 6212 6269 6324 6513 6545 6676 6964 7177 7236 7364 7489 7640 7757 7869 8129 8301 8324 8577 8596 9016 9149 9456 9...

output:

28657

result:

ok single line: '28657'

Test #71:

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

input:

8388608 75025
160 234 339 489 778 984 1042 1154 1235 1362 1641 1841 1865 1930 2094 2232 2289 2368 2423 2481 2545 2576 2583 2735 2753 2794 2921 2943 3168 3202 3455 3587 3647 3681 3694 3971 4033 4098 4271 4435 4462 4664 4713 4739 4816 4878 4913 4960 5079 5088 5417 5425 5536 5699 5873 5970 5985 6078 60...

output:

46367

result:

ok single line: '46367'

Test #72:

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

input:

4194304 46368
130 135 156 416 429 476 615 624 684 805 845 847 884 972 1050 1082 1101 1249 1297 1365 1378 1383 1453 1456 1485 1633 1708 1986 1999 2100 2209 2247 2389 2400 2426 2458 2530 2613 2641 2668 2682 2737 2768 2917 2996 3042 3103 3276 3412 3413 3425 3458 3482 3719 3920 3924 3936 4047 4154 4223 ...

output:

28656

result:

ok single line: '28656'

Test #73:

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

input:

65536 62952
2 3 4 5 6 7 9 10 11 12 13 14 15 16 17 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 66 67 68 69 70 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 88 89 90 91 92 93 94 95 96 97 98 99 100 101 103 104 ...

output:

1596

result:

ok single line: '1596'

Test #74:

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

input:

32768 31171
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 62 63 64 65 66 67 68 69 70 71 72 73 74 75 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:

986

result:

ok single line: '986'

Test #75:

score: 0
Accepted
time: 5ms
memory: 5436kb

input:

524288 58106
3 8 12 20 25 35 36 41 57 76 88 93 115 126 141 144 158 163 173 176 177 190 195 205 216 233 238 240 241 248 272 276 280 318 323 334 341 355 356 358 360 365 371 401 409 413 433 436 454 456 460 464 465 493 494 496 507 516 536 550 560 605 612 617 624 648 665 667 686 702 710 718 721 725 750 7...

output:

25345

result:

ok single line: '25345'

Test #76:

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

input:

524288 70245
8 20 27 29 32 54 56 65 70 72 77 80 83 84 88 94 97 100 102 104 115 118 120 126 158 164 174 180 182 185 196 201 205 206 212 214 243 253 270 281 288 291 292 304 305 333 336 337 339 342 358 361 366 369 372 376 377 395 422 424 425 427 436 441 443 445 448 462 467 468 472 473 484 502 505 520 5...

output:

30732

result:

ok single line: '30732'

Test #77:

score: 0
Accepted
time: 5ms
memory: 6540kb

input:

576460752303423488 75025
10204842620081 31095563547825 46557445163856 48550310638769 52948357149873 65455301915825 66348654463824 69784628300624 72189810635953 75350906565809 80023830983857 87101936438096 95073395739472 108542413179728 116376433527632 121118078071985 122286308526928 132456791083856 ...

output:

46368

result:

ok single line: '46368'

Test #78:

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

input:

576460752303423488 46368
5997902572922 8020870681223 29362524663162 30462036290938 32210126492295 44579632304775 53551780474234 88010341601927 109901751397754 123920524651898 127219059535226 134915640929658 146735390928250 158379085779591 167900989762938 184767364846215 222700516004487 2556858648377...

output:

28657

result:

ok single line: '28657'

Test #79:

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

input:

16777216 100000
65 90 186 663 842 1004 1314 1351 1551 1692 1714 1724 1913 1993 2412 2587 3112 3191 3608 3820 3908 4076 4202 4292 4725 4797 5000 5090 5442 5800 5867 5907 6187 6331 6369 6568 6882 6892 6994 7070 7325 7327 7562 7848 8127 8253 8330 8354 8495 9061 9073 9208 9372 9390 9394 9456 9492 9672 9...

output:

99707

result:

ok single line: '99707'

Test #80:

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

input:

576460752303423488 69170
5815785195258 10213831706362 21208947984122 33766633404679 49159796193543 62990389839610 66751982237959 67388436350714 73985506117370 82781599139578 84344168282375 86543191537927 91577692161786 104135377582343 106970854950650 108533424093447 115766947972858 119528540371207 1...

output:

30239

result:

ok single line: '30239'

Test #81:

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

input:

536870912 100000
10893 16625 16958 17311 37399 38107 38718 42712 47153 49654 53385 53443 58378 79038 94236 95419 98505 99727 104183 112962 116612 132359 132683 140525 143783 144230 144709 150931 158407 159568 160937 171701 172039 175469 182898 189930 193056 197941 204002 221413 255031 257319 265124 ...

output:

99990

result:

ok single line: '99990'

Extra Test:

score: 0
Extra Test Passed