結果

問題 No.1318 ABCD quadruplets
ユーザー convexineqconvexineq
提出日時 2020-12-15 22:30:22
言語 PyPy3
(7.3.15)
結果
TLE  
実行時間 -
コード長 1,774 bytes
コンパイル時間 255 ms
コンパイル使用メモリ 81,688 KB
実行使用メモリ 87,944 KB
最終ジャッジ日時 2023-10-20 06:51:16
合計ジャッジ時間 9,186 ms
ジャッジサーバーID
(参考情報)
judge14 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 39 ms
53,412 KB
testcase_01 AC 40 ms
53,412 KB
testcase_02 AC 40 ms
53,412 KB
testcase_03 AC 40 ms
53,412 KB
testcase_04 AC 40 ms
53,412 KB
testcase_05 AC 41 ms
53,412 KB
testcase_06 AC 39 ms
53,412 KB
testcase_07 AC 39 ms
53,412 KB
testcase_08 AC 40 ms
53,412 KB
testcase_09 AC 40 ms
53,412 KB
testcase_10 AC 40 ms
53,412 KB
testcase_11 AC 40 ms
53,412 KB
testcase_12 AC 40 ms
53,412 KB
testcase_13 AC 140 ms
76,140 KB
testcase_14 AC 392 ms
82,328 KB
testcase_15 AC 90 ms
76,304 KB
testcase_16 AC 1,936 ms
81,868 KB
testcase_17 AC 102 ms
79,460 KB
testcase_18 AC 376 ms
81,696 KB
testcase_19 AC 170 ms
82,376 KB
testcase_20 AC 130 ms
76,144 KB
testcase_21 AC 240 ms
78,092 KB
testcase_22 AC 98 ms
80,932 KB
testcase_23 TLE -
testcase_24 -- -
testcase_25 -- -
testcase_26 -- -
testcase_27 -- -
testcase_28 -- -
testcase_29 -- -
testcase_30 -- -
testcase_31 -- -
testcase_32 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

n,m = map(int,input().split())
ans = [0]*(n+1)
# all different
for a in range(m+1):
    v0 = a*a
    for b in range(a+1,m+1):
        v1 = v0 + b*(a+b)
        if v1 > n: break
        for c in range(b+1,m+1):
            v2 = v1 + c*(a+b+c)
            if v2 > n: break
            for d in range(c+1,m+1):
                v3 = v2 + d*(a+b+c+d)
                if v3 <= n:
                    ans[v3] += 24
# a=b<c<d
for a in range(m+1):
    v1 = 3*a*a
    if v1 > n: break
    for c in range(a+1,m+1):
        v2 = v1 + c*(a+a+c)
        if v2 > n: break
        for d in range(c+1,m+1):
            v3 = v2 + d*(a+a+c+d)
            if v3 <= n:
                ans[v3] += 12
# a<b=c<d
for a in range(m+1):
    for b in range(a+1,m+1):
        v2 = a*a + b*(2*a+3*b)
        if v2 > n: break
        for d in range(b+1,m+1):
            v3 = v2 + d*(a+b+b+d)
            if v3 <= n:
                ans[v3] += 12
# a<b<c=d
for a in range(m+1):
    v0 = a*a
    for b in range(a+1,m+1):
        v1 = v0 + b*(a+b)
        if v1 > n: break
        for c in range(b+1,m+1):
            v3 = v1 + c*(2*a+2*b+3*c)
            if v3 <= n:
                ans[v3] += 12
# a=b=c<d
for a in range(m+1):
    v2 = 6*a*a
    if v2 > n: break
    for d in range(a+1,m+1):
        v3 = v2 + d*(3*a+d)
        if v3 <= n:
            ans[v3] += 4
# a<b=c=d
for d in range(m+1):
    v2 = 6*d*d
    if v2 > n: break
    for a in range(d):
        v3 = v2 + a*(3*d+a)
        if v3 <= n:
            ans[v3] += 4
# a=b<c=d
for a in range(m+1):
    v1 = 3*a*a
    if v1 > n: break
    for c in range(a+1,m+1):
        v3 = v1 + 4*a*c + 3*c*c
        if v3 <= n:
            ans[v3] += 6
# a=b=c=d
for a in range(m+1):
    v3 = 10*a*a
    if v3 <= n:
        ans[v3] += 1

print(*ans,sep="\n")
0