結果

問題 No.800 四平方定理
ユーザー Coki628Coki628
提出日時 2020-08-20 10:38:48
言語 PyPy3
(7.3.15)
結果
TLE  
(最新)
AC  
(最初)
実行時間 -
コード長 1,056 bytes
コンパイル時間 265 ms
コンパイル使用メモリ 82,560 KB
実行使用メモリ 275,712 KB
最終ジャッジ日時 2024-04-21 05:26:13
合計ジャッジ時間 28,141 ms
ジャッジサーバーID
(参考情報)
judge4 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 67 ms
68,480 KB
testcase_01 AC 71 ms
72,320 KB
testcase_02 AC 68 ms
70,656 KB
testcase_03 AC 66 ms
70,596 KB
testcase_04 AC 65 ms
69,888 KB
testcase_05 AC 65 ms
70,656 KB
testcase_06 AC 74 ms
74,112 KB
testcase_07 AC 68 ms
71,888 KB
testcase_08 AC 74 ms
74,496 KB
testcase_09 AC 71 ms
72,960 KB
testcase_10 AC 810 ms
208,120 KB
testcase_11 AC 900 ms
203,108 KB
testcase_12 AC 942 ms
202,968 KB
testcase_13 AC 862 ms
203,132 KB
testcase_14 AC 942 ms
203,004 KB
testcase_15 AC 933 ms
202,808 KB
testcase_16 AC 943 ms
202,876 KB
testcase_17 AC 932 ms
202,864 KB
testcase_18 AC 911 ms
202,868 KB
testcase_19 AC 913 ms
202,976 KB
testcase_20 AC 44 ms
55,828 KB
testcase_21 AC 44 ms
54,212 KB
testcase_22 AC 925 ms
202,888 KB
testcase_23 AC 1,968 ms
275,632 KB
testcase_24 TLE -
testcase_25 TLE -
testcase_26 AC 42 ms
55,184 KB
testcase_27 AC 42 ms
55,332 KB
testcase_28 AC 1,885 ms
275,496 KB
testcase_29 TLE -
testcase_30 TLE -
testcase_31 AC 1,756 ms
275,316 KB
testcase_32 AC 1,954 ms
275,712 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
from collections import Counter

def input(): return sys.stdin.readline().strip()
def list2d(a, b, c): return [[c] * b for i in range(a)]
def list3d(a, b, c, d): return [[[d] * c for j in range(b)] for i in range(a)]
def list4d(a, b, c, d, e): return [[[[e] * d for j in range(c)] for j in range(b)] for i in range(a)]
def ceil(x, y=1): return int(-(-x // y))
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(N=None): return list(MAP()) if N is None else [INT() for i in range(N)]
def Yes(): print('Yes')
def No(): print('No')
def YES(): print('YES')
def NO(): print('NO')
sys.setrecursionlimit(10 ** 9)
INF = 10 ** 19
MOD = 10 ** 9 + 7
EPS = 10 ** -10

N, D = MAP()

C = Counter()
for z in range(1, N+1):
    zz = z**2
    for w in range(1, N+1):
        ww = w**2
        C[zz-ww] += 1

ans = 0
for x in range(1, N+1):
    xx = x**2
    for y in range(x, N+1):
        yy = y**2
        zzww = D - xx - yy
        if x == y:
            ans += C[zzww]
        else:
            ans += C[zzww] * 2
print(ans)
0