#2270. 幸运数字
幸运数字
幸运数字
题目描述
幸运数字 - Problem - QOJ.ac
QOJ.ac
QOJ
[QOJ](//qoj.ac)
Time Limit: 1 s
Memory Limit: 512 MB
Total points: 100
2025 二十六省联合省队选拔 Day 1
A.
幸运数字
[
Statistics ](/contest/1929/problem/10147/statistics)
[
Statement ](#tab-statement)
[ Languages](#)
[Default](/contest/1929/problem/10147/statement/default)
[English](/contest/1929/problem/10147/statement/en)
**This problem is prepared by
Itst and Little09 .**
Submit
Run
Editorials
IDTypeStatusTitlePosted ByLast UpdatedActions
EditorialOpen** Official Editorial**Qingyu- Download
Discussions
About Discussions
The discussion section is only for posting: General Discussions (problem-solving strategies, alternative approaches), and Off-topic conversations.
This is NOT for reporting issues! If you want to report bugs or errors, please use the Issues section below.
Open Discussions 0
No discussions in this category.
Issues
About Issues
If you find any issues with the problem (statement, scoring, time/memory limits, test cases, etc.), you may submit an issue here. A problem moderator will review your issue.
Guidelines:
This is not a place to publish discussions, editorials, or requests to debug your code. Issues are only visible to you and problem moderators.
Do not submit duplicated issues.
Issues must be filed in English or Chinese only.
Active Issues 0
No issues in this category.
Closed/Resolved Issues 0
No issues in this category.
English
[العربية](//qoj.ac/contest/1929/problem/10147?locale=ar)
[English](//qoj.ac/contest/1929/problem/10147?locale=en)
[Español](//qoj.ac/contest/1929/problem/10147?locale=es)
[Français](//qoj.ac/contest/1929/problem/10147?locale=fr)
[日本語](//qoj.ac/contest/1929/problem/10147?locale=ja)
[한국어](//qoj.ac/contest/1929/problem/10147?locale=ko)
[Türkçe](//qoj.ac/contest/1929/problem/10147?locale=tr)
[简体中文](//qoj.ac/contest/1929/problem/10147?locale=zh-cn)
[繁體中文](//qoj.ac/contest/1929/problem/10147?locale=zh-tw)
QOJ.ac | QOJ 4.5.49 (2019-2026)
Made with ❤️ by Qingyu✨ | Contact us: [email protected]
Server Time: 2026-11-09 01:28:54 (UTC+8)
输入格式
(见题面原文)
输出格式
(见题面原文)
数据范围
(见题面原文)
样例
样例 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 1 4
4
1 3 1 3
4 4 1 3
1 3 1 4
1 4 3 4
4
2 3 2 4
4 4 2 3
1 2 2 4
2 4 3 4
4
1 4 2 3
1 2 2 3
2 4 2 2
1 4 2 4
4
2 3 1 4
2 3 1 4
2 4 1 2
4 4 1 4
4
2 2 2 2
1 4 3 4
3 3 2 3
3 3 2 3
4
3 4 1 4
1 1 2 3
3 4 2 4
3 4 2 3
4
3 3 1 2
1 4 3 4
4 4 1 2
2 3 3 4
4
3 3 2 4
2 3 1 4
4 4 4 4
1 1 4 4
4
2 3 2 3
1 1 3 4
1 1 2 4
4 4 2 4
4
1 3 3 4
2 4 4 4
2 3 1 4
2 3 3 4
4
3 4 2 3
1 2 1 3
2 4 3 4
3 4 2 3
4
1 3 1 1
2 4 2 4
2 3 1 1
4 4 3 4
4
1 4 3 4
3 4 1 1
2 4 2 3
1 2 2 4
4
465514809 823872581 85807462 100193696
226319098 561727206 329540011 357539746
187042658 208194346 292596407 296939321
586546808 719067573 7511105 17545663
4
2 2 353599619 721888043
1 1 344235895 749383421
1 2 311753514 603588914
1 1 16498216 903724166
4
20382919 53409314 47655628 982238290
38874156 252508863 682982940 797118706
665270085 883437010 428767848 779958215
43144779 256517962 906171293 977972617
4
51869 51962 16016052 152529745
154381 154455 514388509 722235792
51310 51354 1549803 62448124
51276 51365 129450158 277972052
4
173117 173144 851594938 900265609
57540 57599 13297221 69086292
57433 57509 288854721 602959540
57917 58009 201562461 225981645
4
686026520 798627296 402268059 408416792
496602811 796317351 722502484 730309298
507391177 999332751 431760611 444730750
665034060 863534744 282155715 283372528
4
1 1 111407539 240999937
1 2 256145010 760960163
2 2 141076017 336926441
2 2 312502690 377511353
4
97083416 229355586 93931176 244105389
120426031 870759515 344384041 605651911
561582391 764435492 352992296 844018870
167148693 926925669 761005840 986862334
4
63716 63787 805038673 821155025
64000 64053 599096831 831763380
63995 64008 82016296 375750112
63845 63887 42751762 545799617
4
36324 36407 155078487 200432774
36846 36866 94360939 106742086
36618 36636 39596638 42656545
109909 109934 665393611 818277441
4
579364430 713405927 214945382 233081724
282049080 749890870 317099792 337762131
58040039 604072282 138904374 146873780
566651890 658178549 997536549 998119620
4
1 2 79608257 139460309
2 2 409425318 660528896
2 2 672064144 715580695
1 2 1644848 72916315
4
178847541 465420163 796667425 860258812
601428516 762376478 526563044 678100657
195817402 229421752 253765916 613717744
88530580 664197607 323700172 886231121
4
89776 89778 932856811 992794301
89548 89645 251010583 617380083
89254 89315 7144687 75688670
89005 89024 797764848 887725702
4
64073 64089 711307193 768416220
190699 190788 150821635 207170039
63406 63459 669853864 826951661
63309 63345 552395561 862357818
4
266060006 962067823 874197948 890902947
422753841 436303006 123884719 124829431
40687507 407458080 984013942 985002782
256730824 774905952 945817088 952146948
4
2 2 646986544 766307396
1 2 14016208 701476367
1 2 363638033 374483994
1 1 340324297 466925649
4
347420446 980483629 11931344 934246648
28452515 690998979 111260160 869018605
378723411 881719685 545622604 677683654
332637329 530441103 563001957 779912381
4
52270 52368 411955229 559993206
52217 52288 716456234 913047506
52175 52260 934102839 968914993
52278 52362 20651732 102058041
4
59420 59426 56645191 58528280
59138 59228 612897237 783734096
59074 59172 60329631 105436362
59460 59511 427126574 523858505
1
2
3
2
2
2
3
4
2
1
2
1
3
3
2
2
2
3
2
4
1
3
3
2
4
3
4
4
3
2
4
2
3
2
3
3
2
2
4
4
14386235
410134530
351190368
148521895
362775492
19118874
236435337
642478294
463783322
198238119
38798683
310955632
536558641
366369501
272369065
23034861
361152071
922315305
148037978
141838664