QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#798180 | #9842. Module | ship2077 | AC ✓ | 1ms | 4340kb | C++23 | 516b | 2024-12-04 09:14:13 | 2024-12-04 09:14:13 |
Judging History
answer
#include<bits/stdc++.h>
using namespace std;
long long x,ans,a[1233];
vector<long long>vec;int n;
int main(){
scanf("%d",&n);
for (int i=1;i<=n;i++) scanf("%lld",&a[i]);
sort(a+1,a+n+1,greater<long long>());
scanf("%lld",&x);vec={x};
for (int i=1;i<n;i++){
vector<long long>cur=vec;
for (auto x:vec) if (x>a[i])
cur.emplace_back(x%a[i]);
swap(cur,vec);
}
for (auto x:vec) ans=max(ans,x%a[n]);
printf("%lld\n",ans);
return 0;
}
这程序好像有点Bug,我给组数据试试?
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 0ms
memory: 3900kb
input:
3 5 6 7 15
output:
3
result:
ok single line: '3'
Test #2:
score: 0
Accepted
time: 0ms
memory: 4088kb
input:
4 20 21 22 10 107
output:
9
result:
ok single line: '9'
Test #3:
score: 0
Accepted
time: 0ms
memory: 3824kb
input:
5 5 6 7 8 9 1000000000000
output:
4
result:
ok single line: '4'
Test #4:
score: 0
Accepted
time: 1ms
memory: 3940kb
input:
21 387370091048596 23758943242091 1014205329284566 1140429273127661 47646521198630614 18199351186587118 140264880946836239 2655245896805102 56344740535070 6951532361130740 7919647866064 7816692309555091 147904943861222 2985707194227584 20464369734437689 7043092696894 166312602338536 21129277743988 4...
output:
7040631923013
result:
ok single line: '7040631923013'
Test #5:
score: 0
Accepted
time: 1ms
memory: 3936kb
input:
21 247510449291217 11628490926442390 434735492705046 4500190244809 13500570059509 20424663875119041 53472465601849629 36001519933718 23712845183334 7904282018121 4441687517182397 7801526023507494 1696571625104801 2979914195403441 63234253531881 30443785262144773 1138216562702829 648027358132006 1399...
output:
4499821809855
result:
ok single line: '4499821809855'
Test #6:
score: 0
Accepted
time: 1ms
memory: 3960kb
input:
21 153865317269531 9798845110964597 58748575692624 2761183057119159 1429618739596321 175833177062094089 8392653732399 7228872360279101 3742821283520306 67162297037155858 9927908253394 208486066209650 22380409808341 402847376115969 25653714049373485 18925434023718144 29783723871229 546034935268657 79...
output:
2793876215767
result:
ok single line: '2793876215767'
Test #7:
score: 0
Accepted
time: 1ms
memory: 3980kb
input:
21 211791254487299 3850750382216 203391993130760 9555725640815081 11552250359287 80865751727648 3800690330412095 77658761017939 29584289923057 532517218374341 30806000695645 11094108751232 9950338210520837 3698036330639 25017215154842795 26050324301150416 1451732780715448 68200634692930411 554508011...
output:
3697696074736
result:
ok single line: '3697696074736'
Test #8:
score: 0
Accepted
time: 1ms
memory: 3916kb
input:
21 2874654974287610 215876191314313 61189995018758 10142255969952640 11775065041661 8923540944682 1274791594016 23371178654480 1479733165895279 3925021820071 31400173304912 419406424186624 7525944456704752 1098020466158078 82425454873075 26552771531241947 160198806401794 565203119069864 424930602482...
output:
424871944746
result:
ok single line: '424871944746'
Test #9:
score: 0
Accepted
time: 1ms
memory: 4304kb
input:
21 4644812482582 786810230 12160276957375 2098062763 1774160490371 669941730030186 14424071414 5507378059 677668988531 258846475222 262367927 12058951139787202 83742716537328 83347778211254 1758597041234720 98870437135 218207316244219 4605849393673974 37764836183 251228148855838 31836018389543 19512...
output:
262339846
result:
ok single line: '262339846'
Test #10:
score: 0
Accepted
time: 1ms
memory: 4340kb
input:
21 106616697621293 866859543662 15555166538206 40723954719833 4024560973627004 730761716810845 7026249133 5941544894785 10540516835662264 1533166085218748 191645760868972 2269468146149 2634915118 18443832281 27596989533359788 48305247710 878496221 574937282029240 279126138144046 331110484837 1264719...
output:
878310536
result:
ok single line: '878310536'
Test #11:
score: 0
Accepted
time: 1ms
memory: 4240kb
input:
21 969193328243 17445301082151 4910390705588 33658479950437 603977757209777 45672766174616 6663137071837 1874881898089 12856290218675 119572997441697 121216225864 313046226150475 89394215165 714254988679 88119149632636 2145650816878709 819565681009728 2544110133360 363469851369 267883067948 23069896...
output:
89371596948
result:
ok single line: '89371596948'
Test #12:
score: 0
Accepted
time: 1ms
memory: 3948kb
input:
21 1578283232271824 891048836434 4899334188112 602850535480128 33595386908096 1866428865600 2376032247880 87954587025552 4131999161335344 2009218417321942 230268374168560 297114261422 293140957690850 16335111473738 42768286514008 6237047907206 699952408688 111969748068286 233428360464 76745312500426...
output:
233226691356
result:
ok single line: '233226691356'
Test #13:
score: 0
Accepted
time: 1ms
memory: 3948kb
input:
21 4563397251513 214478880883272 1543639013482 72742019020252 11951717090256 561513097682307 4051958625148 190441305100018 27784751960738 3848668138808640 1738474664283 1470060412163649 193236232412 31291754019255 578958415298 652026741336 217605559725 10612236861962 81923544967509 1305304383739388 ...
output:
193220937045
result:
ok single line: '193220937045'
Test #14:
score: 0
Accepted
time: 0ms
memory: 4012kb
input:
21 1864864975726 914694094546416 6269407850631219 926873323127 7413953093929 2780275472352 33478505570446 1572779304445987 349381635246703 600748235292302 4884137562203 87647969000455 2394700648392545 710457364975 50970798334376 133450811193693 89063992622 19461583809435 266507119199 229465401430919...
output:
89050113741
result:
ok single line: '89050113741'
Test #15:
score: 0
Accepted
time: 1ms
memory: 3948kb
input:
21 1341445020291270 55181844895712 990207506501296 195714151633695 378225545549950 21076404538582 28554041144595 4164136378470 2592396973953938 512386390641655 8047368720034 594913504695 74756064259430 1149736144526 144469130148554 10906059174355 1586349961055 198390553030 383506812058 3511948670232...
output:
198218583513
result:
ok single line: '198218583513'
Test #16:
score: 0
Accepted
time: 0ms
memory: 3916kb
input:
21 11483915273577 640991875905 4335874906251421 1656156800875398 78716974028409 241629688248921 626515939821 632595496374773 5127429820422 3698027346448593 539534902925286 1922807232109 4384782720069 1412520749791293 1670432886630 92293568371990 30066963100662 13459482229157 35251016867049 209114932...
output:
208907003536
result:
ok single line: '208907003536'
Test #17:
score: 0
Accepted
time: 1ms
memory: 3956kb
input:
21 7013544528945 1022824625025 2678789717990 824033280072645 125854117363925 146227846230 329490365014185 314752327170787 2157347513047148 2504708597853 835012925819 389684157085 5648009259068799 862616977678630 18361843868845 120223701439716 17532630005367 6679112867740 45918777148361 4807198707759...
output:
48960202815
result:
ok single line: '48960202815'
Test #18:
score: 0
Accepted
time: 1ms
memory: 4244kb
input:
21 2051483688271 15524331268644 40643556347069 783309247828 108103595941 298444055213 278575456970620 252331642480484 729320033139297 37624698220 862505864972 1909384642447271 112022917811 5371141816985 2263981107945 14061941762684 96382108650517 36814683471067 323536486971 5929437458863 10640633777...
output:
37612574167
result:
ok single line: '37612574167'
Test #19:
score: 0
Accepted
time: 0ms
memory: 3888kb
input:
21 448200986296 21513391730236 1561978159629 28115252470305 192706618923486 56323254484604 149412500764 195380171085 73607290464597 1010681210334796 585786110238 504512566305861 3457980673676430 3137370388076 386045860686124 147456371723576 10738466946318 4100148368649 1320831079994097 8216920706104...
output:
149328224347
result:
ok single line: '149328224347'
Test #20:
score: 0
Accepted
time: 1ms
memory: 4212kb
input:
21 2617750667441 123360401556098 72941207135502 2213615684824258 499946571647871 10641878300643 27861028478715 322962111186569 327375783010 1308877122015822 47119093481725 6871543185506 845525932003609 4064606423214 591216483783 73908963267 1551940968999 190962592927791 17996878889077 981708816817 2...
output:
73898808158
result:
ok single line: '73898808158'
Test #21:
score: 0
Accepted
time: 1ms
memory: 3912kb
input:
21 1287402011465 372859294056689 1133352604681 142419406428629 2555616133167625 23503403585 60484391135270 414566196068785 3022178384126 187272202150 491558071205 54398925229198 158350195734685 8824541878105 976158475741438 20777369258965 7933182547697 3370647963190 70258535245 23102977671125 377879...
output:
23500121538
result:
ok single line: '23500121538'
Test #22:
score: 0
Accepted
time: 0ms
memory: 3952kb
input:
21 213175981820311 204947599074 68509282287 176455280863839 31099946561288 3755825322258 1696402102784 558102636000400 1209442522306002 4523644108705 25744443740871 67399908201570 461965934389947 81425309460533 3825293142542267 9833423021043 11874530223331 565562199647 546333514935 1461131926180889 ...
output:
68421148932
result:
ok single line: '68421148932'
Test #23:
score: 0
Accepted
time: 1ms
memory: 3984kb
input:
21 21499517784 18405409940329 1025691259653 2685310464911 618631574198 232039583197 4252933843993 1623855139397 77487175393 391763314048 1369520919112193 29151905333753 199810403492278 76320769608677 11134946392582 523110440868157 7465819927 7030240135080 149598682491 48185989685907 57032733425 2215...
output:
7459696341
result:
ok single line: '7459696341'
Test #24:
score: 0
Accepted
time: 1ms
memory: 4236kb
input:
21 43653096884289 783374596066293 6349567554627 793875998100 40567085240600 107698511608 2259710208456 15495120741282 114291735839895 2381147850909 16667554812972 278051319700954 860853642122 2050901677563483 5918276983246 1905792152666078 727947824122344 106206134980518 322850717910 299222110635396...
output:
107688376038
result:
ok single line: '107688376038'
Test #25:
score: 0
Accepted
time: 1ms
memory: 3948kb
input:
21 30519081447135 188948133232 3753634752907650 1278206804160544 566833828042 186487821986426 27207949744438 1433760888954687 3967826224640 209182852914546 212265089955 71231923910288 4450717215399 1695552092019 547647913956411 488231542048990 635939060658 10391925323026 11656599554178 1511553350894...
output:
188933962165
result:
ok single line: '188933962165'
Test #26:
score: 0
Accepted
time: 0ms
memory: 4236kb
input:
21 67700196998784 25858963176209 420748955941 60549677339179 3363909521183 3771114413320 177241627820143 179862440976 1436650710117 1086530282584039 2844573282115705 158522414325197 9876692529843 23126617692340 1261552825708 1214832431564792 538837717031 8830175737841 464024686461645 415017565636412...
output:
179801362284
result:
ok single line: '179801362284'
Test #27:
score: 0
Accepted
time: 0ms
memory: 3832kb
input:
21 1 2 4 8 16 32 64 128 256 512 1024 2048 4096 8192 16384 32768 65536 131072 262144 524288 1048576 2097152
output:
0
result:
ok single line: '0'
Test #28:
score: 0
Accepted
time: 0ms
memory: 4084kb
input:
1 1000000000000000000 1000000000000000000
output:
0
result:
ok single line: '0'
Test #29:
score: 0
Accepted
time: 0ms
memory: 3824kb
input:
1 999999999999999999 1000000000000000000
output:
1
result:
ok single line: '1'
Test #30:
score: 0
Accepted
time: 0ms
memory: 4084kb
input:
1 1000000000000000000 999999999999999999
output:
999999999999999999
result:
ok single line: '999999999999999999'
Test #31:
score: 0
Accepted
time: 0ms
memory: 3820kb
input:
1 1 1
output:
0
result:
ok single line: '0'
Extra Test:
score: 0
Extra Test Passed