結果
問題 | No.800 四平方定理 |
ユーザー | pasoconhoshii |
提出日時 | 2019-03-18 00:24:37 |
言語 | Python3 (3.12.2 + numpy 1.26.4 + scipy 1.12.0) |
結果 |
TLE
|
実行時間 | - |
コード長 | 449 bytes |
コンパイル時間 | 86 ms |
コンパイル使用メモリ | 10,600 KB |
実行使用メモリ | 179,696 KB |
最終ジャッジ日時 | 2023-09-22 16:13:53 |
合計ジャッジ時間 | 4,842 ms |
ジャッジサーバーID (参考情報) |
judge15 / judge12 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 56 ms
15,684 KB |
testcase_01 | AC | 90 ms
13,732 KB |
testcase_02 | AC | 69 ms
11,116 KB |
testcase_03 | AC | 76 ms
13,676 KB |
testcase_04 | AC | 62 ms
11,124 KB |
testcase_05 | AC | 73 ms
13,664 KB |
testcase_06 | AC | 111 ms
13,672 KB |
testcase_07 | AC | 84 ms
13,704 KB |
testcase_08 | AC | 110 ms
13,692 KB |
testcase_09 | AC | 92 ms
13,756 KB |
testcase_10 | TLE | - |
testcase_11 | TLE | - |
testcase_12 | -- | - |
testcase_13 | -- | - |
testcase_14 | -- | - |
testcase_15 | -- | - |
testcase_16 | -- | - |
testcase_17 | -- | - |
testcase_18 | -- | - |
testcase_19 | -- | - |
testcase_20 | -- | - |
testcase_21 | -- | - |
testcase_22 | -- | - |
testcase_23 | -- | - |
testcase_24 | -- | - |
testcase_25 | -- | - |
testcase_26 | -- | - |
testcase_27 | -- | - |
testcase_28 | -- | - |
testcase_29 | -- | - |
testcase_30 | -- | - |
testcase_31 | -- | - |
testcase_32 | -- | - |
ソースコード
N,D = map(int, input().split()) from collections import defaultdict cnt = defaultdict(int) lst = [ i**2 for i in range(1, N+1)] for i in range(N): for j in range(N): # if i == j: cnt[ lst[i] + lst[j] ] += 1 # else: # cnt[ lst[i] + lst[j] ] += 2 ans = 0 for i in range(N): for j in range(N): x,y = lst[i], lst[j] # if i == j : ans += cnt[ y+D - x ] print(ans)