QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#447077#4214. Deja Vubear0131TL 347ms5640kbC++142.3kb2024-06-17 21:11:302024-06-29 06:58:20

Judging History

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

  • [2024-06-29 06:58:20]
  • 管理员手动重测本题所有提交记录
  • 测评结果:TL
  • 用时:347ms
  • 内存:5640kb
  • [2024-06-28 21:31:34]
  • hack成功,自动添加数据
  • (/hack/708)
  • [2024-06-17 21:11:30]
  • 评测
  • 测评结果:100
  • 用时:343ms
  • 内存:5724kb
  • [2024-06-17 21:11:30]
  • 提交

answer

#include<bits/stdc++.h>
#define rep(i, n) for(int i = 0; i < (n); ++i)
using namespace std;
typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef pair<int, int> pii;
typedef pair<ll, int> pli;
typedef pair<ll, ll> pll;
typedef array<int, 3> ai3;
const int inf = 0x3f3f3f3f;
const ll INF = 0x3f3f3f3f3f3f3f3fll;
const int Mod = 1e9 + 7;
inline void uadd(int &a, int b){ a += b-Mod; a += (a>>31) & Mod; }
inline void usub(int &a, int b){ a -= b, a += (a>>31) & Mod; }
inline void umul(int &a, int b){ a = (int)(1ll * a * b % Mod); }
inline int add(int a, int b){ a += b-Mod; a += (a>>31) & Mod; return a; }
inline int sub(int a, int b){ a -= b, a += (a>>31) & Mod; return a; }
inline int mul(int a, int b){ a = (int)(1ll * a * b % Mod); return a; }
int qpow(int b, ll p){ int ret = 1; while(p){ if(p&1) umul(ret, b); umul(b, b), p >>= 1; } return ret; }
const int fN = 10010;
int fact[fN], invfact[fN], pw2[fN], invpw2[fN], inv[fN];
void initfact(int n){
	pw2[0] = 1; for(int i = 1; i <= n; ++i) pw2[i] = mul(pw2[i-1], 2);
	invpw2[0] = 1; for(int i = 1; i <= n; ++i) invpw2[i] = mul(invpw2[i-1], (Mod+1) / 2);
	fact[0] = 1; for(int i = 1; i <= n; ++i) fact[i] = mul(fact[i-1], i);
	invfact[n] = qpow(fact[n], Mod-2); for(int i = n; i > 0; --i) invfact[i-1] = mul(invfact[i], i);
	for(int i = 1; i <= n; ++i) inv[i] = mul(invfact[i], fact[i-1]);
}
int binom(int n, int m){ return (m < 0 || m > n) ? 0 : mul(fact[n], mul(invfact[m], invfact[n-m])); }
const double pi = acos(-1);
template<typename T> inline void chmax(T &_a, T _b){ (_a<_b) ? (_a=_b) : 0; }
template<typename T> inline void chmin(T &_a, T _b){ (_b<_a) ? (_a=_b) : 0; }
mt19937_64 rng(58);
inline int myrand(int l, int r){ return (int)(rng() % (r-l+1)) + l; }

int n, q, a[500500];

int main(){
	ios::sync_with_stdio(false);
	cin.tie(0);

	cin >> n >> q;
	rep(i, n) cin >> a[i];

	while(q--){
		int tp;
		cin >> tp;
		if(tp == 1){
			int x, y;
			cin >> x >> y;
			--x;
			a[x] = y;
		} else {
			int l;
			cin >> l;
			--l;
			int mn0 = inf, mn1 = inf, mn2 = inf, ans = -1;
			for(int i = l; i < n; ++i){
				chmin(mn0, a[i]);
				if(mn0 < a[i]) chmin(mn1, a[i]);
				if(mn1 < a[i]) chmin(mn2, a[i]);
				if(mn2 < a[i]){ ans = i+1; break; }
			}
			cout << ans << "\n";
		}
	}

	return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

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

input:

11 10
1 2 3 4 5 10 9 8 7 6 8
2 1
1 3 2
2 1
1 1 2
2 1
2 5
2 6
1 9 6
1 10 7
2 5

output:

4
5
6
-1
-1
11

result:

ok 6 numbers

Test #2:

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

input:

6 7
2 3 6 10 2 3
2 3
2 1
2 5
2 4
1 4 7
1 2 3
1 4 4

output:

-1
4
-1
-1

result:

ok 4 number(s): "-1 4 -1 -1"

Test #3:

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

input:

4 9
10 7 4 4
2 2
1 3 1
1 3 4
1 4 3
1 4 8
1 4 2
2 3
1 1 7
2 2

output:

-1
-1
-1

result:

ok 3 number(s): "-1 -1 -1"

Test #4:

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

input:

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

output:

-1
-1
-1
-1

result:

ok 4 number(s): "-1 -1 -1 -1"

Test #5:

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

input:

3 1
2 7 6
1 1 6

output:


result:

ok 0 number(s): ""

Test #6:

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

input:

6 9
5 3 10 1 4 8
2 4
2 5
1 6 9
2 6
1 2 8
2 6
1 6 6
2 6
2 3

output:

-1
-1
-1
-1
-1
-1

result:

ok 6 numbers

Test #7:

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

input:

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

output:

-1
-1

result:

ok 2 number(s): "-1 -1"

Test #8:

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

input:

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

output:

-1
-1
-1
-1
-1
-1

result:

ok 6 numbers

Test #9:

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

input:

8 10
217400736 245088203 438403019 544276344 623130600 771196890 806732388 943246485
1 5 597885336
2 4
1 4 467449103
2 4
2 1
2 7
2 1
1 8 895177001
2 6
2 1

output:

7
7
4
-1
4
-1
4

result:

ok 7 numbers

Test #10:

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

input:

9 10
193163402 243977660 377454846 464717358 505938403 645114858 737147728 896624758 907949852
2 7
2 2
1 8 815720321
1 4 493251485
2 7
1 3 337311288
1 6 634446148
1 7 777046439
1 3 348388680
1 3 365967702

output:

-1
5
-1

result:

ok 3 number(s): "-1 5 -1"

Test #11:

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

input:

11 12
85526606 329382857 394199721 497022557 467462442 598693728 552286093 799983855 866068842 850488024 951465304
2 8
1 6 440234998
1 10 973849238
2 4
2 8
1 3 296857547
1 7 659027526
1 2 170353108
1 3 294186048
1 7 532972742
2 9
2 10

output:

-1
9
-1
-1
-1

result:

ok 5 number(s): "-1 9 -1 -1 -1"

Test #12:

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

input:

17 12
81700615 177358844 210484653 210027365 339128965 387608288 406322108 521926061 534447685 650723289 612710353 643285058 708879134 761413753 914021166 878531863 947497596
2 2
1 11 582959768
1 9 547592964
1 8 511979012
2 4
2 11
1 11 562446299
1 5 383781991
2 6
2 5
1 1 144692431
2 15

output:

6
7
14
9
8
-1

result:

ok 6 numbers

Test #13:

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

input:

16 20
107686776 187399557 261923862 271763306 275071944 329173892 426516538 443145534 527414173 683878357 635498457 740630422 848403640 813320023 889976700 976183503
2 11
2 1
1 7 415631805
2 10
1 11 762634175
2 4
2 7
1 12 709031691
2 10
2 13
2 2
2 4
2 16
2 1
1 11 716122093
2 6
1 1 70063421
2 9
1 8 5...

output:

15
4
15
7
10
15
-1
5
7
-1
4
9
13
4

result:

ok 14 numbers

Test #14:

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

input:

13 12
156189537 143195484 180384697 326238301 488125041 482236236 560273273 549954003 573091577 723307221 729723772 947621215 930274243
1 9 737120303
1 4 280169823
1 6 373132039
2 3
2 3
2 4
1 5 433523095
1 6 435547215
1 11 800378380
1 7 579236843
1 8 564152858
2 5

output:

7
7
9
9

result:

ok 4 number(s): "7 7 9 9"

Test #15:

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

input:

18 19
59610219 122962133 162846878 243630045 227212798 312668404 382475181 485322503 552195231 522627834 637369897 716064716 761450540 793669806 852048828 825968217 932181701 969223872
2 13
2 10
1 13 758223974
1 3 116194810
2 4
2 12
1 13 773203784
1 17 964126579
2 4
1 2 123312890
2 9
2 15
1 1 756492...

output:

17
13
8
15
8
13
-1
12
8
13
12

result:

ok 11 numbers

Test #16:

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

input:

195 124
14982138 14340371 21995736 15372479 29336424 34074870 40351882 36579502 54997653 57485403 62760845 63820611 72591491 72101224 82413793 86127668 94240185 87684082 97876299 104326166 105368645 121670981 112481616 121624907 124864528 139713173 138666696 148743068 157548284 148185712 166462219 1...

output:

42
101
128
22
12
167
56
116
57
75
21
173
50
102
19
64
34
137
102
144
99
93
15
81
134
70
86
25
166
145
113
7
165
25
-1
75
192
116
25
93
192
17
160
128
142
44
-1
173
27
83
98
53
95
135
93
88
153
167
11
79
87
123
95
190
69

result:

ok 65 numbers

Test #17:

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

input:

481 208
4427829 2791666 9240280 12378824 9086399 14302785 18360122 17551102 18033637 19893562 26729687 28132448 27081770 32159393 32421041 34524503 38394864 37843353 41979211 40997165 45769610 45833001 51006968 51957236 55063648 53788674 59676931 59564031 58646263 61740940 66753955 68929118 67757973...

output:

17
183
462
102
16
243
202
11
77
335
81
7
423
162
315
229
327
57
394
471
201
85
285
360
382
388
9
183
228
249
148
295
354
341
271
141
168
365
168
262
260
288
422
114
205
9
162
339
267
-1
182
119
261
-1
180
361
289
297
198
119
218
236
81
451
450
274
273
203
359
212
57
56
227
132
77
178
86
23
302
81
43...

result:

ok 93 numbers

Test #18:

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

input:

383 492
3825364 8239320 9700611 8602345 14451115 20824368 23019406 25834506 27477784 23569339 27498227 30647271 31753323 37730561 42280048 41245122 43077145 51423216 54624407 56391663 53702148 55484564 64667404 64473778 66054081 67763248 72245663 77335769 76454411 76103218 79407064 85558573 86318518...

output:

278
7
249
43
145
126
95
247
286
174
227
74
166
74
171
34
163
162
147
165
252
126
244
22
364
326
220
41
199
66
306
229
118
108
78
347
80
266
65
105
80
309
362
371
248
245
13
198
276
71
26
77
307
190
166
128
168
86
359
251
84
218
312
293
85
378
103
371
359
64
321
4
74
227
220
263
312
364
62
53
330
325...

result:

ok 248 numbers

Test #19:

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

input:

36 499
949563491 936519709 924916927 895053248 854787338 828947833 793617419 814775908 734615977 738150932 714741162 724958289 698239960 663519437 645079621 542385269 529754602 492361836 519469354 442234937 426538210 380542231 374271617 332246729 355264370 296203702 269581427 275177171 195147255 175...

output:

-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
...

result:

ok 266 numbers

Test #20:

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

input:

399 235
998046309 996656147 993823957 991906931 992171052 987368672 986867819 983098593 975544961 973171106 973473472 967590126 969338289 965200807 964711940 964064315 962390073 959707924 952880810 947965073 947964928 947535641 943184735 938388913 939579771 934493926 935215622 934907551 931908207 92...

output:

-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
...

result:

ok 116 numbers

Test #21:

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

input:

44 313
994520608 956056574 956365026 898208706 884750341 886864131 848188052 803692416 830508038 775479109 752797833 763616424 696894356 718139948 659504525 671719169 613198941 598382002 574971436 540054882 549948381 513261611 489523582 481704805 428512129 452322618 428175381 361212522 391709550 336...

output:

-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
...

result:

ok 164 numbers

Test #22:

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

input:

13 116
972728992 896720334 814542532 705222488 706483145 557075980 462311520 431032677 468166449 337717590 345520949 240374290 171270777
1 8 562739167
1 2 875866720
1 4 678061929
1 1 932888117
1 2 985595759
1 1 955298692
2 5
2 10
1 9 441537451
2 10
2 11
1 8 394515711
2 7
2 1
1 12 138019313
2 8
2 7
2...

output:

-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1

result:

ok 57 numbers

Test #23:

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

input:

359 338
994957002 996646569 990863516 991951270 986147723 988787303 979186329 980575877 975227298 972081128 972990837 964114560 966593071 960631341 956225015 956528774 953685841 951210770 950416501 947796926 945981249 938758280 937087509 933720792 934188097 929348476 930245343 924778901 924793681 91...

output:

-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
...

result:

ok 174 numbers

Test #24:

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

input:

187 169
999769149 989266191 988824107 983455532 974019954 967731435 959694878 956806534 953257636 942738337 951695957 941578379 934957776 923302949 921743757 911009430 918234043 910838899 901214606 894766671 896579331 892828789 881290925 877465634 874083122 860423087 854728022 848355094 841699245 84...

output:

-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1

result:

ok 76 numbers

Test #25:

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

input:

272 193
997200981 992008970 993378381 989158492 984958692 981937381 979940197 975646797 973873251 965248253 957107501 960249234 953356966 955659853 942509454 947118835 936098597 934504735 932426340 925581033 920260613 920541013 922894177 912492900 911965364 908245656 900095708 899515683 895535358 88...

output:

-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
...

result:

ok 103 numbers

Test #26:

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

input:

1159 3614
999893947 999053143 997609072 998397141 996402659 996486516 995637260 994015810 990665888 991144444 992795725 989712287 989232481 986583622 985809855 985406547 984777406 986671401 982847135 981423296 984430802 981799093 979397727 977772362 980070766 978202670 976594405 978184468 977283563 ...

output:

-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
97
-1
-1
-1
-1
-1
-1
-1
-1
-1
97
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
97
-1
-1
-1
461
97
-1
-1
-1
-1
-1
97
-1
-1
97
461
-1
-1
97
461
461
-1
461
-1
461
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
461...

result:

ok 1792 numbers

Test #27:

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

input:

2459 3903
999909568 999929064 999199975 998567069 997415590 997742359 997400924 997890441 997117377 996184112 996516877 994628646 995226210 993674519 994824410 994172139 993670882 992184322 993020381 991356970 991318462 991510599 991340754 989945608 990280031 990600554 989837298 989711709 988620530 ...

output:

1591
1591
1591
1591
-1
-1
-1
1591
155
155
155
1591
1591
-1
-1
1591
155
1591
-1
155
155
1591
1591
-1
-1
-1
1591
-1
1591
-1
1591
-1
-1
-1
1591
-1
-1
1591
155
-1
1591
1591
1591
-1
-1
-1
-1
-1
1591
-1
1591
1591
-1
1591
1591
1591
1591
-1
1591
-1
-1
1591
155
1591
-1
1591
1591
1591
-1
-1
1591
1591
-1
-1
15...

result:

ok 1984 numbers

Test #28:

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

input:

1848 2401
999461663 997921641 998606943 997577190 997452317 997063811 995605563 995370050 996203617 994276759 994457491 993699255 993575713 993469696 993388165 990484437 989735697 990229558 989770352 990367208 988672812 989527749 988244607 987627617 987847582 986493320 986296198 984789641 985596561 ...

output:

1087
1087
1528
1087
1087
1087
-1
1087
1378
1087
1087
-1
1528
1528
1378
1378
-1
1452
1452
1452
1087
1087
-1
1087
1087
-1
1087
1378
1378
1087
1378
1087
1087
1087
1087
1378
1087
1087
1087
1452
1087
1087
1087
1378
1087
1087
769
769
-1
-1
1378
1087
-1
769
1452
769
769
1528
1528
-1
-1
769
769
1087
1378
15...

result:

ok 1165 numbers

Test #29:

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

input:

4203 3677
688477303 783919825 412687922 891170834 476006623 740071321 551591641 537273931 750346053 79471767 10250007 579772593 873929217 702600917 894799681 150368200 601912739 196251807 293868917 154765630 469060346 49369625 430659437 129019354 565284093 469271238 552490408 543198084 23661658 6080...

output:

482
547
3830
896
1462
3912
837
2431
2380
4041
2197
1763
737
2533
300
1127
2094
3984
656
1783
354
1539
610
232
1151
47
1514
2608
773
3657
1799
1445
3702
3407
3833
1087
2197
936
1503
4009
1503
670
3104
3307
1421
814
2347
4074
813
333
3237
41
2400
3751
1671
1689
1923
1137
2511
3887
264
3350
3324
1771
5...

result:

ok 1864 numbers

Test #30:

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

input:

953 200
616015938 303866647 556279378 535884282 360748191 109602991 222487076 515908243 399883764 770073466 241250580 244095552 746150682 304666635 583573652 320190567 270514558 43841820 512817073 497465466 286430274 286192071 670289782 617935789 38313178 565746472 219277924 991414394 202073070 7978...

output:

255
596
15
885
900
768
61
95
257
738
492
34
261
170
339
779
574
71
261
757
266
562
229
854
629
600
757
316
34
165
-1
229
370
316
370
152
524
930
735
225
112
103
419
122
500
705
587
359
543
202
375
452
71
682
817
528
801
28
183
347
650
545
112
34
115
923
735
214
266
274
435
137
182
834
613
486
941
86...

result:

ok 96 numbers

Test #31:

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

input:

16135 8128
281824907 496304344 39682632 149281884 266361235 616205944 663542279 945880009 322288462 916355934 489826877 427934673 955724949 655769803 570996087 995591508 897142827 835572040 473220393 814471777 78282370 203733985 32912498 370931168 289077699 531050019 194705570 385724758 721784980 32...

output:

5971
10084
10206
4721
6166
10772
13451
4104
6660
10543
4659
14143
12091
6265
8256
12549
12467
8844
16005
12586
11255
3032
10719
12607
11895
9653
12990
12025
5630
4038
11878
11945
13453
2469
14456
1373
14276
14656
289
14070
10962
955
340
13734
15714
9198
2024
14627
9442
14206
2319
14303
4804
4310
119...

result:

ok 4058 numbers

Test #32:

score: 0
Accepted
time: 26ms
memory: 3616kb

input:

26387 27762
999988451 999910185 999913353 999837724 999775762 999791696 999739889 999644074 999770080 999582981 999641561 999495997 999444272 999579429 999385115 999497655 999321746 999393922 999316550 999248847 999213109 999248298 999055090 999137721 999000925 999102106 998957346 999015311 99900805...

output:

7447
12689
15849
20464
12689
24843
4251
20464
-1
24843
24843
1607
15849
4251
15849
20464
12689
24843
8641
12689
4251
12689
12689
12689
12689
12689
12689
24843
6101
24843
1607
12689
12689
24843
24843
20464
6101
20464
24843
24843
1607
25431
16465
1607
4251
12689
24843
4251
6101
8045
25431
-1
20464
204...

result:

ok 14072 numbers

Test #33:

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

input:

26211 27792
999999316 999901645 999905449 999955767 999876466 999718932 999780764 999675563 999692074 999577987 999520413 999503924 999576189 999575026 999415817 999411655 999282811 999321536 999342557 999289888 999163200 999165756 999160451 999178205 998970761 999077290 999000545 999033264 99893380...

output:

25268
25952
20151
1249
18339
1429
10186
23477
6141
22543
10186
1429
3434
7418
25268
11264
7418
1249
26172
7418
20997
12466
21737
17148
20151
17477
25268
6141
10186
11264
11264
-1
11264
7418
2527
22543
10186
17148
6141
1429
25952
17148
7418
10186
20997
17148
17148
17148
2527
10186
1249
23477
17477
17...

result:

ok 13896 numbers

Test #34:

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

input:

500000 500000
999999883 999993680 999998293 999996195 999992637 999987483 999983088 999989853 999987940 999981903 999977240 999980164 999975079 999974695 999974212 999972803 999967221 999965344 999966462 999956155 999958220 999957770 999957804 999950728 999953167 999947241 999942888 999943254 999940...

output:

57076
195978
439632
160238
102868
307407
456286
365804
47784
319401
380405
361959
177745
436977
304883
295993
366105
321827
271143
170506
154039
446779
347463
20549
209742
421992
265329
68678
107636
468330
361959
138210
95290
396915
4097
162370
449504
136235
464446
449504
197764
255767
318375
183574...

result:

ok 250163 numbers

Test #35:

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

input:

500000 500000
999995748 999992642 999990708 999992779 999989363 999986482 999991915 999986611 999981104 999979678 999983384 999980331 999978455 999969467 999968205 999967560 999966054 999967009 999960943 999963400 999955798 999961571 999951144 999955799 999947589 999950193 999944489 999940673 999944...

output:

363205
254108
113538
141193
382149
461169
108331
375691
352020
351373
483454
321033
246185
16932
240161
481673
331374
91084
214798
29846
269958
279506
109295
91084
260278
370451
394457
494824
154077
177771
9354
260278
27956
121594
417912
66823
357291
471608
20903
275887
254108
246185
491388
138031
4...

result:

ok 249846 numbers

Test #36:

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

input:

500000 500000
999997805 999998182 999992998 999993144 999989051 999993323 999986985 999988853 999978990 999985710 999978723 999973141 999978734 999973863 999975927 999968655 999965006 999966207 999960182 999959176 999958448 999959013 999950054 999949574 999955174 999948809 999951599 999945066 999943...

output:

191431
106912
145214
84404
445205
44815
95105
371273
105475
41584
447811
386573
487024
163362
332547
29207
467420
342029
389940
397435
23843
46445
427075
376963
177934
63173
116544
23351
180553
488919
48849
51612
239217
294515
278709
116544
403462
243012
310393
254253
284795
311808
332547
467420
148...

result:

ok 250262 numbers

Test #37:

score: 0
Accepted
time: 347ms
memory: 5640kb

input:

500000 500000
999998149 999995539 999990234 999992947 999995027 999985793 999988673 999982861 999981585 999985603 999975736 999972986 999979268 999973426 999971377 999968817 999966371 999966000 999967224 999961796 999960142 999952642 999952327 999957852 999946797 999948734 999948530 999945319 999940...

output:

136549
411483
6227
17651
251107
81732
128267
399356
270631
305906
488393
403637
88952
429693
384740
153978
239686
120347
83836
414083
445329
261446
120732
477073
311345
226635
456403
297092
449645
445329
344150
355980
77016
311345
157509
300294
226169
401693
452260
403637
2494
186575
62035
205397
49...

result:

ok 250013 numbers

Test #38:

score: 0
Accepted
time: 113ms
memory: 5468kb

input:

500000 500000
3546 4925 7431 4414 8747 13678 15207 20364 15387 19222 22148 29678 23428 25307 29227 35206 39858 38829 43223 41112 39156 43999 42804 48087 52782 52113 57304 57669 59856 58081 61054 67912 62115 65115 69898 77796 79939 75470 82880 85735 85623 87174 88287 85872 90219 94167 90816 96800 102...

output:

314635
251046
300731
188897
155725
138923
242828
171004
28289
364339
358381
223284
319884
456122
193188
450886
351378
178151
212518
134794
321748
328461
471091
359109
247261
231974
222594
304911
499934
109415
358246
480223
355254
47448
27032
59879
425041
435266
483854
129453
485600
321595
411917
435...

result:

ok 249794 numbers

Test #39:

score: 0
Accepted
time: 104ms
memory: 5560kb

input:

500000 500000
6090 5769 4131 6115 11421 9052 15711 14570 20620 17938 20507 28421 22818 24969 35741 33187 33686 35807 39395 42744 42598 42079 46927 53991 48060 55582 54880 61463 59511 65805 67568 63594 70358 64761 74512 69239 74317 79126 79684 85024 83102 86029 84501 87074 90303 94361 98106 93824 100...

output:

981
51550
339475
341392
425435
482845
38846
132800
197580
469726
75046
262855
187213
154296
5798
49421
420202
77500
154569
337382
347488
475164
96082
105051
420520
343931
52884
128845
358858
95792
355984
133294
307773
49025
272593
403247
130893
464728
317816
192103
271597
133772
300948
480705
18970
...

result:

ok 250445 numbers

Test #40:

score: 0
Accepted
time: 103ms
memory: 5516kb

input:

500000 500000
495312448 737430173 882362288 434000723 963968508 207954738 445657356 525626144 411067963 757670866 917194200 941918939 529644022 86155191 893828027 914483733 42147114 826794739 64336992 460276387 327611016 626962386 572354745 288129666 961898316 886228038 157135147 159417409 880263021...

output:

99986
175853
281662
323298
53633
295481
168354
476427
57441
328416
417644
485835
497253
121254
404335
313495
268317
336167
244649
150965
234428
182483
488666
389638
78882
266125
64784
489787
312464
471881
435335
253485
92021
433746
331872
449892
77708
3564
305074
202081
376431
76193
56778
232991
439...

result:

ok 249794 numbers

Test #41:

score: 0
Accepted
time: 99ms
memory: 5456kb

input:

500000 500000
540818729 97298193 250768855 501219813 2786501 909617269 467410601 747435921 503642046 998793744 921907130 533874751 299318443 482675715 474867159 741597986 865240457 151302533 931974447 129660416 78215710 919999476 381719374 517382374 487696074 674718873 364173638 312831464 358577575 ...

output:

64224
411814
51811
211175
157289
450492
171527
493142
187037
65361
250292
140184
96512
366425
418484
34580
171969
485371
16318
357875
132578
94207
281970
218120
308724
363252
326167
347959
99225
459274
155638
83194
135500
219115
321964
439845
452457
316234
137778
372830
413532
143429
120140
492252
7...

result:

ok 249586 numbers

Test #42:

score: 0
Accepted
time: 100ms
memory: 5416kb

input:

500000 500000
805165461 376975195 319471526 807551555 497477870 220223958 296039419 791728334 114663028 952986595 949613753 447641578 291956604 797993884 894578466 305647422 334577485 359151420 886741926 440528375 803797706 421145344 131803524 919870608 440517389 561908162 724179476 782645931 717306...

output:

482671
35112
31819
434375
139674
52492
33451
404441
375525
249287
233150
177701
496660
246431
183208
136292
197301
419938
124933
210799
442669
218410
333416
232064
493081
238143
408156
71709
12799
255826
339348
330128
406989
470890
10894
243028
438325
57151
387975
6400
48484
198542
272325
46805
3686...

result:

ok 249326 numbers

Test #43:

score: 0
Accepted
time: 102ms
memory: 5440kb

input:

500000 500000
2424 7420 10098 10771 6041 16605 13925 12348 21904 24942 27391 25393 29232 27675 35888 33920 37867 38340 40955 41405 39521 42946 51207 46123 55119 51069 55007 55628 58729 63682 60962 67505 68997 68680 70640 68616 76731 81403 80302 80398 84286 84832 85325 92959 92603 88079 96748 98611 1...

output:

1699
59645
190074
3483
265189
355340
361980
244346
10255
170776
407294
82126
31368
253783
274461
382396
403627
321604
351300
456390
140986
371454
337941
170982
449643
237629
97950
129336
72888
212404
30371
424278
293908
286950
75035
152799
45718
140106
234641
99426
487636
89766
476959
200507
366242
...

result:

ok 500000 numbers

Test #44:

score: 0
Accepted
time: 113ms
memory: 5456kb

input:

500000 500000
206688347 359053254 534247994 232546607 363625975 661464779 785654730 244725901 915736394 337404790 969725581 489733200 105231797 980949386 725276950 736378227 886308163 126190068 589568585 851434950 274775151 845321929 72349863 578944465 595324899 863108015 501334052 764432745 8085824...

output:

451790
99313
270295
490611
304458
186677
111723
210493
429073
394886
315527
403997
268920
416916
384359
215321
46425
14838
134819
344677
215953
196600
178907
81415
34895
82248
54280
16640
163451
368683
197123
482591
261318
8793
186804
323484
155137
126667
136282
62106
141015
402941
165027
273421
417...

result:

ok 500000 numbers

Test #45:

score: 0
Accepted
time: 105ms
memory: 5468kb

input:

500000 500000
96584041 378695100 846891767 720272020 346123822 51105196 142079930 632599212 363604914 942026676 724556914 342072452 542288560 461992921 744551053 183459718 489085763 728271317 171841073 618307051 240714824 230154047 943278092 920573925 967554465 256181845 684502108 63523627 960252561...

output:

234590

result:

ok 1 number(s): "234590"

Test #46:

score: 0
Accepted
time: 113ms
memory: 5456kb

input:

500000 500000
883281041 986631985 405296103 973583417 73550754 832624898 616834455 437937581 122963321 688606974 330720341 113933274 202669924 682561076 686008838 631371229 94759816 389422561 577231470 740509440 342599344 53917880 774265662 657484830 408832320 319247851 524670314 909413082 294890869...

output:

156453
216182
381974
188096
433998
28917
427828
398158
16466
422381
232374
326460
57668
168393
5614
459640
40173
194493
385256
454808
39438
78345
71878
97509
53216
98821
207588
27313
95653
260266
292881
70496
121199
438195
35662
284209
456361
7681
369675
134189
118312
192126
390837
323170
202474
221...

result:

ok 503 numbers

Test #47:

score: -100
Time Limit Exceeded

input:

500000 500000
500000 499999 499998 499997 499996 499995 499994 499993 499992 499991 499990 499989 499988 499987 499986 499985 499984 499983 499982 499981 499980 499979 499978 499977 499976 499975 499974 499973 499972 499971 499970 499969 499968 499967 499966 499965 499964 499963 499962 499961 499960...

output:

-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
...

result: