結果

問題 No.2517 Right Triangles on Circle
ユーザー 👑 rin204rin204
提出日時 2023-10-27 21:30:30
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 229 ms / 2,000 ms
コード長 324 bytes
コンパイル時間 160 ms
コンパイル使用メモリ 81,776 KB
実行使用メモリ 168,820 KB
最終ジャッジ日時 2023-10-27 21:30:36
合計ジャッジ時間 5,072 ms
ジャッジサーバーID
(参考情報)
judge11 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 36 ms
53,488 KB
testcase_01 AC 35 ms
53,488 KB
testcase_02 AC 37 ms
53,488 KB
testcase_03 AC 36 ms
53,488 KB
testcase_04 AC 35 ms
53,488 KB
testcase_05 AC 35 ms
53,488 KB
testcase_06 AC 35 ms
53,488 KB
testcase_07 AC 36 ms
53,488 KB
testcase_08 AC 35 ms
53,488 KB
testcase_09 AC 34 ms
53,488 KB
testcase_10 AC 35 ms
53,488 KB
testcase_11 AC 35 ms
53,488 KB
testcase_12 AC 34 ms
53,488 KB
testcase_13 AC 226 ms
159,056 KB
testcase_14 AC 200 ms
159,064 KB
testcase_15 AC 225 ms
168,776 KB
testcase_16 AC 211 ms
168,820 KB
testcase_17 AC 169 ms
117,240 KB
testcase_18 AC 153 ms
113,068 KB
testcase_19 AC 144 ms
115,368 KB
testcase_20 AC 158 ms
111,348 KB
testcase_21 AC 229 ms
163,316 KB
testcase_22 AC 84 ms
98,252 KB
testcase_23 AC 164 ms
136,144 KB
testcase_24 AC 94 ms
103,592 KB
testcase_25 AC 73 ms
90,456 KB
testcase_26 AC 185 ms
147,144 KB
testcase_27 AC 77 ms
95,268 KB
testcase_28 AC 64 ms
81,040 KB
testcase_29 AC 89 ms
101,908 KB
testcase_30 AC 74 ms
87,796 KB
testcase_31 AC 179 ms
136,416 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

n, m = map(int, input().split())
A = list(map(int, input().split()))
cnt = {}
ans = 0
for a in A:
    a *= 4
    a %= 4 * m
    cnt[a] = cnt.get(a, 0) + 1

for a in cnt.keys():
    if a >= 2 * m:
        continue
    b = a + 2 * m
    ca = cnt.get(a, 0)
    cb = cnt.get(b, 0)
    ans += ca * cb * (n - ca - cb)

print(ans)
0