QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#879601#9690. Iron Warriorucup-team987AC ✓88ms9344kbPython3485b2025-02-02 07:23:072025-02-02 07:23:08

Judging History

This is the latest submission verdict.

  • [2025-02-02 07:23:08]
  • Judged
  • Verdict: AC
  • Time: 88ms
  • Memory: 9344kb
  • [2025-02-02 07:23:07]
  • Submitted

answer

def f(n):
    d,r,b=0,5,0
    if n%2==1:d=b=10
    n//=2
    A=2*d+2*b+2*b*n+53*n+2*r*n*n+2*r*n+11*n*n
    B=-6-2*b+15*n-2*r*n+10*n*n
    C=-15*n-21
    D=5
    def g(x):
        return (A+B*x+C*x*x+D*x*x*x)//2
    ans=max(g(0),g(n))
    #g'=3*D*x*x+2*C*x+B=0 <=> x=-C-sqrt(C*C-3*D*B)
    m=round((-C-(C*C-3*D*B)**0.5)/(3*D))
    sz=100000
    L=max(m-sz,0)
    R=min(m+sz,n)
    for x in range(L,R+1):
        ans=max(ans,g(x))
    return ans
print(f(int(input())))

这程序好像有点Bug,我给组数据试试?

詳細信息

Test #1:

score: 100
Accepted
time: 12ms
memory: 9088kb

input:

1

output:

20

result:

ok answer is '20'

Test #2:

score: 0
Accepted
time: 11ms
memory: 9088kb

input:

3

output:

72

result:

ok answer is '72'

Test #3:

score: 0
Accepted
time: 9ms
memory: 9088kb

input:

4

output:

105

result:

ok answer is '105'

Test #4:

score: 0
Accepted
time: 12ms
memory: 9088kb

input:

5

output:

145

result:

ok answer is '145'

Test #5:

score: 0
Accepted
time: 12ms
memory: 9088kb

input:

6

output:

208

result:

ok answer is '208'

Test #6:

score: 0
Accepted
time: 11ms
memory: 9088kb

input:

7

output:

248

result:

ok answer is '248'

Test #7:

score: 0
Accepted
time: 11ms
memory: 8960kb

input:

8

output:

343

result:

ok answer is '343'

Test #8:

score: 0
Accepted
time: 76ms
memory: 9216kb

input:

486036

output:

13810882446441423

result:

ok answer is '13810882446441423'

Test #9:

score: 0
Accepted
time: 71ms
memory: 9344kb

input:

857503

output:

75842693981321486

result:

ok answer is '75842693981321486'

Test #10:

score: 0
Accepted
time: 75ms
memory: 9344kb

input:

459087

output:

11638561802272893

result:

ok answer is '11638561802272893'

Test #11:

score: 0
Accepted
time: 60ms
memory: 9216kb

input:

326354

output:

4181111331905669

result:

ok answer is '4181111331905669'

Test #12:

score: 0
Accepted
time: 74ms
memory: 9216kb

input:

755041

output:

51774938180590304

result:

ok answer is '51774938180590304'

Test #13:

score: 0
Accepted
time: 71ms
memory: 9344kb

input:

1000000

output:

120283726342420340

result:

ok answer is '120283726342420340'

Test #14:

score: 0
Accepted
time: 71ms
memory: 9216kb

input:

562451495

output:

21401951468280078633294014

result:

ok answer is '21401951468280078633294014'

Test #15:

score: 0
Accepted
time: 72ms
memory: 9344kb

input:

100214615

output:

121057415160393160185480

result:

ok answer is '121057415160393160185480'

Test #16:

score: 0
Accepted
time: 70ms
memory: 9216kb

input:

726997959

output:

46216571009844858875968944

result:

ok answer is '46216571009844858875968944'

Test #17:

score: 0
Accepted
time: 74ms
memory: 9088kb

input:

883477562

output:

82943950684199531529718356

result:

ok answer is '82943950684199531529718356'

Test #18:

score: 0
Accepted
time: 77ms
memory: 9216kb

input:

456878752

output:

11470993586298146794567272

result:

ok answer is '11470993586298146794567272'

Test #19:

score: 0
Accepted
time: 76ms
memory: 9216kb

input:

1000000000

output:

120281308501417045326995605

result:

ok answer is '120281308501417045326995605'

Test #20:

score: 0
Accepted
time: 88ms
memory: 9088kb

input:

151798318021627311

output:

420725672820572820226091469784149314525410684999074

result:

ok answer is '420725672820572820226091469784149314525410684999074'

Test #21:

score: 0
Accepted
time: 88ms
memory: 9216kb

input:

466154514052238226

output:

12183941850211915347991952173009567537536253846445099

result:

ok answer is '12183941850211915347991952173009567537536253846445099'

Test #22:

score: 0
Accepted
time: 84ms
memory: 9216kb

input:

262261097390039057

output:

2169700342816432479937347535029836266637820523889883

result:

ok answer is '2169700342816432479937347535029836266637820523889883'

Test #23:

score: 0
Accepted
time: 86ms
memory: 9216kb

input:

409768988622482114

output:

8275903133852517858111731626726122320253985666412809

result:

ok answer is '8275903133852517858111731626726122320253985666412809'

Test #24:

score: 0
Accepted
time: 88ms
memory: 9216kb

input:

361773749401383499

output:

5695204039674250675619463634360070429230287130689713

result:

ok answer is '5695204039674250675619463634360070429230287130689713'

Test #25:

score: 0
Accepted
time: 86ms
memory: 9216kb

input:

1000000000000000000

output:

120281306081172036692984324273260313737335405903162447

result:

ok answer is '120281306081172036692984324273260313737335405903162447'

Extra Test:

score: 0
Extra Test Passed