結果

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

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 98 ms
71,424 KB
testcase_01 AC 96 ms
71,272 KB
testcase_02 AC 91 ms
71,272 KB
testcase_03 AC 94 ms
71,292 KB
testcase_04 AC 92 ms
71,276 KB
testcase_05 AC 91 ms
70,940 KB
testcase_06 AC 92 ms
71,180 KB
testcase_07 AC 92 ms
71,404 KB
testcase_08 AC 91 ms
71,356 KB
testcase_09 AC 91 ms
71,340 KB
testcase_10 AC 94 ms
71,172 KB
testcase_11 AC 93 ms
71,372 KB
testcase_12 AC 93 ms
71,288 KB
testcase_13 AC 367 ms
78,484 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,b,b) > N:break
        for c in range(b,M+1):
            if f(a,b,c,c) > 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