結果
問題 |
No.1318 ABCD quadruplets
|
ユーザー |
|
提出日時 | 2022-10-09 08:41:17 |
言語 | PyPy3 (7.3.15) |
結果 |
TLE
|
実行時間 | - |
コード長 | 1,008 bytes |
コンパイル時間 | 708 ms |
コンパイル使用メモリ | 82,304 KB |
実行使用メモリ | 82,560 KB |
最終ジャッジ日時 | 2024-06-23 08:16:24 |
合計ジャッジ時間 | 11,723 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 19 TLE * 2 -- * 9 |
ソースコード
def solve(N, M): res = [0] * (N + 1) for a in range(M + 1): for b in range(a, M + 1): for c in range(b, M + 1): for d in range(c, M + 1): x = a ** 2 + a * b + a * c + a * d + b ** 2 + b * c + b * d + c ** 2 + c * d + d ** 2 if x > N: break if a == b == c == d: res[x] += 1 elif a == b == c: res[x] += 4 elif b == c == d: res[x] += 4 elif a == b and c == d: res[x] += 6 elif a == b: res[x] += 12 elif b == c: res[x] += 12 elif c == d: res[x] += 12 else: res[x] += 24 return res N, M = map(int, input().split()) print(*solve(N, M), sep="\n")