結果

問題 No.1318 ABCD quadruplets
ユーザー ああいいああいい
提出日時 2022-01-29 19:50:03
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 1,647 ms / 2,000 ms
コード長 1,403 bytes
コンパイル時間 935 ms
コンパイル使用メモリ 87,120 KB
実行使用メモリ 80,572 KB
最終ジャッジ日時 2023-08-30 19:32:45
合計ジャッジ時間 16,957 ms
ジャッジサーバーID
(参考情報)
judge12 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 91 ms
71,608 KB
testcase_01 AC 90 ms
71,576 KB
testcase_02 AC 90 ms
71,740 KB
testcase_03 AC 88 ms
71,820 KB
testcase_04 AC 93 ms
71,884 KB
testcase_05 AC 90 ms
71,524 KB
testcase_06 AC 91 ms
71,576 KB
testcase_07 AC 90 ms
71,568 KB
testcase_08 AC 91 ms
71,804 KB
testcase_09 AC 89 ms
71,372 KB
testcase_10 AC 89 ms
71,616 KB
testcase_11 AC 89 ms
71,636 KB
testcase_12 AC 87 ms
71,644 KB
testcase_13 AC 158 ms
78,408 KB
testcase_14 AC 689 ms
79,728 KB
testcase_15 AC 144 ms
78,692 KB
testcase_16 AC 855 ms
79,572 KB
testcase_17 AC 160 ms
79,536 KB
testcase_18 AC 626 ms
79,520 KB
testcase_19 AC 312 ms
79,984 KB
testcase_20 AC 160 ms
78,296 KB
testcase_21 AC 218 ms
78,740 KB
testcase_22 AC 156 ms
80,156 KB
testcase_23 AC 1,647 ms
80,080 KB
testcase_24 AC 1,528 ms
79,992 KB
testcase_25 AC 407 ms
80,368 KB
testcase_26 AC 257 ms
79,664 KB
testcase_27 AC 1,116 ms
80,048 KB
testcase_28 AC 458 ms
79,496 KB
testcase_29 AC 556 ms
80,224 KB
testcase_30 AC 1,637 ms
80,572 KB
testcase_31 AC 430 ms
79,996 KB
testcase_32 AC 1,644 ms
80,412 KB
権限があれば一括ダウンロードができます

ソースコード

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
def count(a,b,c,d):
    num = 4
    if a == b:num -= 1
    if b == c:num -= 1
    if c == d:num -= 1
    if num == 1:return 1
    if num == 3:return 12
    if num == 4:return 24
    if a < b or c < d:return 4
    return 6
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
                    """
                    dat[u] += count(a,b,c,d)
                else:
                    break
for i in dat:
    print(i)
0