QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#723901#9133. Function with Many Maximumsucup-team3646AC ✓105ms26900kbPython3563b2024-11-08 02:57:272024-11-08 02:57:28

Judging History

你现在查看的是最新测评结果

  • [2024-11-08 02:57:28]
  • 评测
  • 测评结果:AC
  • 用时:105ms
  • 内存:26900kb
  • [2024-11-08 02:57:27]
  • 提交

answer

"""
A を降順ソート
f(A[k]) = A[1] + A[2] + ... + A[k-1] + (k+1)*A[k] になる

k >= 10^5 の偶数で
f(A[k]) = f(A[k+2]) となるようにしたい
-> k*A[k]=A[k+1]+(k+3)*A[k+2] となるように適当に A[k+1], A[k+2] を決めればよさそう
"""

A = [10**12 - i for i in range(10**5)]
k = 10**5
for _ in range(10**5 + 10):
    val = k * A[-1]
    res2 = (val - (k + 5)) // (k + 4)
    res1 = val - res2 * (k + 3)
    assert A[-1] > res1 > res2
    A.append(res1)
    A.append(res2)
    k += 2

print(len(A))
print(*A[::-1])

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

詳細信息

Test #1:

score: 100
Accepted
time: 105ms
memory: 26884kb

input:

4

output:

300020
111097695843 111098074341 111099177058 111099668746 111100658303 111100962927 111102139577 111102556917 111103620881 111104150697 111105102215 111105444259 111106583578 111107037624 111108064971 111108630779 111109546394 111109923722 111111027846 111111516462 111112509328 111113108992 1111139...

result:

ok n=300020, max_a=1000000000000, max_num=100011 >= 4

Test #2:

score: 0
Accepted
time: 104ms
memory: 26900kb

input:

100000

output:

300020
111097695843 111098074341 111099177058 111099668746 111100658303 111100962927 111102139577 111102556917 111103620881 111104150697 111105102215 111105444259 111106583578 111107037624 111108064971 111108630779 111109546394 111109923722 111111027846 111111516462 111112509328 111113108992 1111139...

result:

ok n=300020, max_a=1000000000000, max_num=100011 >= 100000

Extra Test:

score: 0
Extra Test Passed