結果

問題 No.1318 ABCD quadruplets
ユーザー ayaoniayaoni
提出日時 2020-12-16 02:49:45
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 1,641 bytes
コンパイル時間 180 ms
コンパイル使用メモリ 81,620 KB
実行使用メモリ 83,652 KB
最終ジャッジ日時 2023-10-20 08:54:35
合計ジャッジ時間 10,784 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 WA -
testcase_02 WA -
testcase_03 WA -
testcase_04 WA -
testcase_05 WA -
testcase_06 WA -
testcase_07 AC 37 ms
53,440 KB
testcase_08 WA -
testcase_09 WA -
testcase_10 WA -
testcase_11 AC 37 ms
53,440 KB
testcase_12 WA -
testcase_13 WA -
testcase_14 WA -
testcase_15 WA -
testcase_16 WA -
testcase_17 AC 95 ms
80,320 KB
testcase_18 WA -
testcase_19 WA -
testcase_20 WA -
testcase_21 WA -
testcase_22 AC 96 ms
81,068 KB
testcase_23 WA -
testcase_24 WA -
testcase_25 WA -
testcase_26 AC 162 ms
82,520 KB
testcase_27 WA -
testcase_28 WA -
testcase_29 WA -
testcase_30 WA -
testcase_31 WA -
testcase_32 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys

sys.setrecursionlimit(10**7)
def I(): return int(sys.stdin.readline().rstrip())
def MI(): return map(int,sys.stdin.readline().rstrip().split())
def LI(): return list(map(int,sys.stdin.readline().rstrip().split()))
def LI2(): return list(map(int,sys.stdin.readline().rstrip()))
def S(): return sys.stdin.readline().rstrip()
def LS(): return list(sys.stdin.readline().rstrip().split())
def LS2(): return list(sys.stdin.readline().rstrip())


N,M = MI()

ANS = [0]*(N+1)
for a in range(M+1):
    x = a**2
    if x+9*a**2 > N:
        break
    for b in range(a,M+1):
        y = x+b*(a+b)
        if y+7*b**2 > N:
            break
        for c in range(b,M+1):
            z = y+c*(a+b+c)
            if z+4*c**2 > N:
                break
            for d in range(c,M+1):
                w = z+d*(a+b+c+d)
                if w > N:
                    break
                if a == b:
                    if b == c:
                        if c == d:
                            ANS[w] += 1
                        else:
                            ANS[w] += 4
                    else:
                        if c == d:
                            ANS[w] += 6
                        else:
                            ANS[w] += 12
                else:
                    if b == c:
                        if c == d:
                            ANS[w] += 4
                        else:
                            ANS[w] += 12
                    else:
                        if c == d:
                            ANS[w] += 12
                        else:
                            ANS[w] += 24

print(*ANS,sep='\n')
0