結果
問題 | No.1318 ABCD quadruplets |
ユーザー |
![]() |
提出日時 | 2020-12-16 16:25:06 |
言語 | PyPy3 (7.3.15) |
結果 |
AC
|
実行時間 | 851 ms / 2,000 ms |
コード長 | 1,394 bytes |
コンパイル時間 | 181 ms |
コンパイル使用メモリ | 82,984 KB |
実行使用メモリ | 84,352 KB |
最終ジャッジ日時 | 2024-09-20 05:09:48 |
合計ジャッジ時間 | 9,271 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 30 |
ソースコード
import syssys.setrecursionlimit(10**6)int1 = lambda x: int(x)-1p2D = lambda x: print(*x, sep="\n")def II(): return int(sys.stdin.buffer.readline())def MI(): return map(int, sys.stdin.buffer.readline().split())def MI1(): return map(int1, sys.stdin.buffer.readline().split())def LI(): return list(map(int, sys.stdin.buffer.readline().split()))def LI1(): return list(map(int1, sys.stdin.buffer.readline().split()))def LLI(rows_number): return [LI() for _ in range(rows_number)]def BI(): return sys.stdin.buffer.readline().rstrip()def SI(): return sys.stdin.buffer.readline().rstrip().decode()dij = [(0, 1), (-1, 0), (0, -1), (1, 0)]inf = 10**16# md = 998244353md = 10**9+7n, m = MI()ans = [0]*(n+1)for a in range(m+1):s1 = a**2if s1 > n: breakfor b in range(a+1):s2 = s1+b*(a+b)ab = a == bif s2 > n: breakfor c in range(b+1):s3 = s2+c*(a+b+c)bc = b == cif s3 > n: breakfor d in range(c+1):s4 = s3+d*(a+b+c+d)cd = c == dif s4 > n: breakabcd = ab+bc+cdif abcd == 0: cur = 24elif abcd == 3: cur = 1elif abcd == 1: cur = 12elif ab and cd: cur = 6else: cur = 4ans[s4] += curprint(*ans, sep="\n")