結果
問題 | No.800 四平方定理 |
ユーザー | FromBooska |
提出日時 | 2023-03-03 04:47:45 |
言語 | PyPy3 (7.3.15) |
結果 |
TLE
|
実行時間 | - |
コード長 | 513 bytes |
コンパイル時間 | 638 ms |
コンパイル使用メモリ | 81,660 KB |
実行使用メモリ | 298,868 KB |
最終ジャッジ日時 | 2023-10-17 23:22:45 |
合計ジャッジ時間 | 30,601 ms |
ジャッジサーバーID (参考情報) |
judge15 / judge13 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 78 ms
75,156 KB |
testcase_01 | AC | 94 ms
83,920 KB |
testcase_02 | AC | 84 ms
77,420 KB |
testcase_03 | AC | 86 ms
80,480 KB |
testcase_04 | AC | 82 ms
77,112 KB |
testcase_05 | AC | 91 ms
81,292 KB |
testcase_06 | AC | 101 ms
87,260 KB |
testcase_07 | AC | 86 ms
80,844 KB |
testcase_08 | AC | 100 ms
87,256 KB |
testcase_09 | AC | 95 ms
84,360 KB |
testcase_10 | AC | 1,984 ms
251,896 KB |
testcase_11 | TLE | - |
testcase_12 | TLE | - |
testcase_13 | TLE | - |
testcase_14 | TLE | - |
testcase_15 | TLE | - |
testcase_16 | TLE | - |
testcase_17 | TLE | - |
testcase_18 | TLE | - |
testcase_19 | TLE | - |
testcase_20 | AC | 43 ms
53,384 KB |
testcase_21 | AC | 42 ms
53,384 KB |
testcase_22 | TLE | - |
testcase_23 | TLE | - |
testcase_24 | -- | - |
testcase_25 | -- | - |
testcase_26 | -- | - |
testcase_27 | -- | - |
testcase_28 | -- | - |
testcase_29 | -- | - |
testcase_30 | -- | - |
testcase_31 | -- | - |
testcase_32 | -- | - |
ソースコード
# 公式解説より # 2重ループは可能、を押し進めるべきだった # x, yで作れる数を全探索 # w, D, zで作れる数を全探索 # その組合せ数が答え N, D = map(int, input().split()) from collections import defaultdict xy = defaultdict(int) wDz = defaultdict(int) for x in range(1, N+1): for y in range(1, N+1): calc1 = x**2+y**2 xy[calc1] += 1 calc2 = x**2+D-y**2 wDz[calc2] += 1 ans = 0 for num in xy: ans += xy[num]*wDz[num] print(ans)