結果

問題 No.1318 ABCD quadruplets
ユーザー ayaoni
提出日時 2020-12-16 02:49:45
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 1,641 bytes
コンパイル時間 150 ms
コンパイル使用メモリ 82,312 KB
実行使用メモリ 84,572 KB
最終ジャッジ日時 2024-09-20 04:24:36
合計ジャッジ時間 10,707 ms
ジャッジサーバーID
(参考情報)
judge5 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample WA * 3
other AC * 5 WA * 25
権限があれば一括ダウンロードができます

ソースコード

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