QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#274871 | #19. Pyramid | bobbilyking | 30 | 147ms | 8264kb | Python3 | 584b | 2023-12-04 03:38:57 | 2023-12-04 03:38:58 |
Judging History
answer
import math
def lcm(a, b):
return a*b//math.gcd(a,b)
n, m = map(int, input().split())
a = list(map(int, input().split()))
def solve(m):
cnt = 0
for bm in range(1, 2**n):
bias, l = -1, 1
for j in range(0, n):
if ((1<<j)&bm):
bias*=-1
l = lcm(l, a[j])
cnt += bias * (m//l)
return cnt
for _ in range(0, m):
rank = int(input())
l, r = 0, 10**60
while r-l>1:
m = (l+r)//2
(l := m) if solve(m) < rank else (r := m)
print(r)
Details
Tip: Click on the bar to expand more detailed information
Subtask #1:
score: 0
Time Limit Exceeded
Test #1:
score: 10
Accepted
time: 147ms
memory: 8264kb
input:
4 50 160170927438273 13 15 2 180423 745688 64848 693929 253438 780397 629077 665503 952292 416311 97760 364091 781335 228858 358112 941489 396993 297182 325269 64984 157360 594741 524328 211765 398912 526184 535991 806805 694217 319687 440663 611862 949865 170323 966443 374437 171193 693136 727390 5...
output:
316960 1309994 113922 1219065 445230 1370967 1105136 1169128 1672946 731356 171740 639618 1372616 402048 629115 1653968 697420 522076 571418 114162 276444 1044816 921116 372020 700791 924376 941604 1417360 1219570 561613 774137 1074892 1668682 299216 1697805 657795 300744 1217671 1277848 1000256 513...
result:
ok 50 lines
Test #2:
score: -10
Time Limit Exceeded
input:
13 50 266851 7 1751 129 9 2 5 2 8 3 7 3 2 391497 145266 915295 200833 674175 191553 672170 120464 777810 602863 875173 111620 699988 394856 182249 570186 520785 169508 106402 654746 953104 439857 887814 827092 462333 69173 150071 291812 182944 636921 144611 470680 945213 666792 675054 454815 874469 ...
output:
result:
Subtask #2:
score: 30
Accepted
Test #6:
score: 30
Accepted
time: 29ms
memory: 8192kb
input:
2 50 17771136336081539 3 330463005200449932 39583119993410600 227422596111515420 5216990832097530 330562395720880314 46911693168131678 75561024860927522 233087263213182367 1041638514989081 273998571464130991 61121009404587104 61519075469706514 52949685546801822 154724493736712593 124625756731535803 ...
output:
991389015601349685 118749359980231788 682267788334546182 15650972496292590 991687187162640831 140735079504395019 226683074582782542 699261789639547023 3124915544967243 821995714392392880 183363028213761291 184557226409119521 158849056640405448 464173481210137725 373877270194607367 150551724458621754...
result:
ok 50 lines
Test #7:
score: 0
Accepted
time: 33ms
memory: 8156kb
input:
2 50 12546231532127 1417 141944859660991 115840225132015 54473954192473 256397188469397 89562851487309 397292247358136 477681743192931 307426812456134 398226551248031 20723075598884 622246183845300 271101721648570 180116391867779 314238535610876 63203243280782 699616922121468 634940794753438 3930377...
output:
201135866116923907 164145598993539397 77189593082022525 363314816020130403 126910560543193817 562963114442940432 676875030027989923 435623793201176229 564287023054772862 29364598120304265 881722842409277024 384151139532667741 255224927247838067 445276004910357387 89558995718760633 991357178534232419...
result:
ok 50 lines
Test #8:
score: 0
Accepted
time: 19ms
memory: 8252kb
input:
1 50 32076230 20866502610 14228423784 21923037339 27198952806 17145254736 16916168003 16869714946 25941093937 20266662268 27189876819 31162274156 17925394539 28013230711 16395781282 27731788536 13398481003 8217182626 1275342073 151177954 20181590958 18213545580 29058466068 219787453 2970467841 15033...
output:
669318737013960300 456394193833054320 703208387984351970 872439865964401380 549955134320525280 542606895582868690 541116856642333580 832092495574817510 650078120240689640 872148742517912370 999568273150911880 574979078073707970 898558831329099530 525914851431126860 889531227392099280 429772758302858...
result:
ok 50 lines
Test #9:
score: 0
Accepted
time: 20ms
memory: 8160kb
input:
1 50 1159973 815732317847 90110000118 847525309402 325014269115 33521523936 507704819742 554727275533 185638163852 628522851524 843933988042 479385964552 71762668958 462811608287 193589284524 518114957632 350927257824 196659338946 570816584710 229333687365 628238483 443495163774 678992068874 3540857...
output:
946227463929938131 104525167166876814 983106475722966146 377007776788133895 38884062684613728 588923882870586966 643468661981840609 215335257837895996 729069537650848852 978940639911042866 556074775459277096 83242758399218134 536848969699496251 224558343137157852 600999361749263936 40706614403987875...
result:
ok 50 lines
Test #10:
score: 0
Accepted
time: 21ms
memory: 8208kb
input:
1 50 14135213536085915 32 53 38 22 64 30 26 63 4 59 15 52 67 8 18 14 65 26 12 43 5 36 61 11 54 13 15 3 53 45 48 54 11 70 42 70 9 64 12 56 30 50 69 11 44 24 20 1 1 70
output:
452326833154749280 749166317412553495 537138114371264770 310974697793890130 904653666309498560 424056406082577450 367515551938233790 890518452773412645 56540854144343660 833977598629068985 212028203041288725 735031103876467580 947059306917756305 113081708288687320 254433843649546470 1978929895052028...
result:
ok 50 lines
Subtask #3:
score: 0
Skipped
Dependency #1:
0%