結果

問題 No.1318 ABCD quadruplets
ユーザー ああいいああいい
提出日時 2022-01-29 19:43:19
言語 PyPy3
(7.3.15)
結果
TLE  
実行時間 -
コード長 1,088 bytes
コンパイル時間 307 ms
コンパイル使用メモリ 87,128 KB
実行使用メモリ 78,604 KB
最終ジャッジ日時 2023-08-30 19:26:45
合計ジャッジ時間 8,681 ms
ジャッジサーバーID
(参考情報)
judge11 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 91 ms
71,616 KB
testcase_01 AC 92 ms
71,632 KB
testcase_02 AC 100 ms
71,716 KB
testcase_03 AC 94 ms
71,480 KB
testcase_04 AC 99 ms
71,576 KB
testcase_05 AC 95 ms
71,604 KB
testcase_06 AC 91 ms
71,512 KB
testcase_07 AC 93 ms
71,532 KB
testcase_08 AC 93 ms
71,424 KB
testcase_09 AC 92 ms
71,480 KB
testcase_10 AC 93 ms
71,724 KB
testcase_11 AC 94 ms
71,708 KB
testcase_12 AC 92 ms
71,636 KB
testcase_13 AC 471 ms
78,604 KB
testcase_14 TLE -
testcase_15 -- -
testcase_16 -- -
testcase_17 -- -
testcase_18 -- -
testcase_19 -- -
testcase_20 -- -
testcase_21 -- -
testcase_22 -- -
testcase_23 -- -
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())

def f(a,b,c,d):
    return a * (a + b + c + d) + b * (b + c + d) + c * (c + d) + d * d
dat = [0] * (N + 1)
from collections import defaultdict
for a in range(M+1):
    for b in range(a,M+1):
        if f(a,b,0,0) > N:break
        for c in range(b,M+1):
            if f(a,b,c,0) > N:break
            for d in range(c,M+1):
                u = f(a,b,c,d)
                if u <= N:
                    s = defaultdict(int)
                    s[a] += 1
                    s[b] += 1
                    s[c] += 1
                    s[d] += 1
                    e = 0
                    if len(s) == 1:
                        e = 1
                    elif len(s) == 3:
                        e = 12
                    elif len(s) == 4:
                        e = 24
                    else:
                        if s[a] == 1 or s[a] == 3:
                            e = 4
                        else:
                            e = 6
                    dat[u] += e
                else:
                    break
for i in dat:
    print(i)
0