UOJ Logo

NOI.AC

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#171344#959. 合并数组heyuzhen10014ms1316kbC++485b2023-06-22 21:48:132023-06-22 21:48:14

answer

#include <bits/stdc++.h>
using namespace std;
#define ll long long
ll n,m,a[1000005],b[1000005],l = 1,r = 1;
int main(){
	scanf("%lld%lld",&n,&m);
	for(ll i = 1;i <= n;i++)
		scanf("%lld",&a[i]);
	for(ll i = 1;i <= m;i++)
		scanf("%lld",&b[i]);
	while(l <= n && r <= m){
		printf("%lld\n",min(a[l],b[r]));
		if(a[l] < b[r])l++;
		else r++;
	}
	while(l <= n){
		printf("%lld\n",a[l]);
		l++;
	}
	while(r <= m){
		printf("%lld\n",b[r]);
		r++;
	}
	return 0;
}


详细

小提示:点击横条可展开更详细的信息

Test #1:

score: 10
Accepted
time: 3ms
memory: 1308kb

input:

6739 7642
38 78 108 112 241 330 340 340 550 776 957 1048 1078 1138 1154 1204 1270 1282 1369 1380 148...

output:

12
38
78
108
112
188
241
271
330
337
340
340
345
474
479
523
550
578
598
776
957
1040
1048
1078
1138...

result:

ok 14381 lines

Test #2:

score: 10
Accepted
time: 3ms
memory: 1276kb

input:

3715 6917
22 239 266 280 550 595 644 711 797 828 946 957 1209 1508 1541 1926 1980 2029 2280 2463 246...

output:

22
36
63
94
223
239
266
280
325
371
454
457
550
595
627
644
678
711
780
797
828
898
900
922
946
957
...

result:

ok 10632 lines

Test #3:

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

input:

1450 3333
143 509 566 760 882 1142 1858 2295 2847 3415 3936 4197 4331 5127 5984 7188 7292 7450 7545 ...

output:

21
143
158
319
420
509
533
566
651
711
760
772
846
882
897
907
1109
1142
1302
1305
1712
1816
1825
18...

result:

ok 4783 lines

Test #4:

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

input:

9667 5929
61 83 182 239 243 289 309 377 496 504 519 520 538 641 650 760 761 992 1118 1179 1188 1281 ...

output:

57
61
83
182
239
243
289
309
377
434
496
504
519
520
538
586
641
650
760
761
814
992
1105
1118
1179
...

result:

ok 15596 lines

Test #5:

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

input:

5515 768
112 183 261 296 315 379 436 492 497 504 513 736 760 789 814 960 1059 1437 1448 1766 2180 24...

output:

112
183
230
261
296
315
379
436
492
497
504
513
736
760
789
814
836
960
1059
1437
1448
1766
1908
218...

result:

ok 6283 lines

Test #6:

score: 10
Accepted
time: 1ms
memory: 1288kb

input:

7298 4374
3 30 138 149 179 185 264 421 431 486 619 781 917 974 1274 1335 1383 1406 1447 1481 1497 19...

output:

3
30
138
149
179
185
208
264
289
310
421
424
431
486
619
719
781
917
939
974
1012
1027
1086
1097
111...

result:

ok 11672 lines

Test #7:

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

input:

1499 76
68 305 1086 1218 1353 2007 2565 4071 4638 4858 4990 5119 5636 5657 7166 7740 8085 8200 8971 ...

output:

68
305
1086
1218
1353
2007
2565
2620
3103
4071
4638
4858
4990
5119
5636
5657
7166
7740
8085
8200
897...

result:

ok 1575 lines

Test #8:

score: 10
Accepted
time: 4ms
memory: 1308kb

input:

6073 7835
173 218 309 473 516 581 633 654 812 1173 1225 1337 1453 1524 1609 1649 1755 1792 1896 1923...

output:

65
122
144
164
166
173
218
287
309
316
324
429
473
487
516
581
585
633
654
659
724
726
773
812
828
8...

result:

ok 13908 lines

Test #9:

score: 10
Accepted
time: 2ms
memory: 1288kb

input:

8005 4177
146 243 284 351 409 411 427 434 491 629 644 744 752 790 801 834 849 885 1201 1282 1323 143...

output:

5
54
125
146
243
284
351
409
411
427
434
491
492
629
644
667
744
752
757
790
801
834
842
849
885
106...

result:

ok 12182 lines

Test #10:

score: 10
Accepted
time: 1ms
memory: 1288kb

input:

9273 2559
19 40 64 77 92 140 153 166 235 330 436 466 488 517 545 615 691 768 952 970 1023 1163 1175 ...

output:

19
40
64
77
88
92
140
153
166
190
235
275
305
330
432
436
462
466
488
517
545
615
691
731
768
952
97...

result:

ok 11832 lines