結果

問題 No.2517 Right Triangles on Circle
ユーザー miya145592miya145592
提出日時 2023-10-27 22:20:08
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 276 ms / 2,000 ms
コード長 490 bytes
コンパイル時間 974 ms
コンパイル使用メモリ 81,764 KB
実行使用メモリ 211,216 KB
最終ジャッジ日時 2023-10-27 22:20:14
合計ジャッジ時間 5,364 ms
ジャッジサーバーID
(参考情報)
judge12 / judge10
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 39 ms
53,648 KB
testcase_01 AC 39 ms
53,648 KB
testcase_02 AC 39 ms
53,648 KB
testcase_03 AC 40 ms
53,648 KB
testcase_04 AC 40 ms
53,648 KB
testcase_05 AC 42 ms
55,696 KB
testcase_06 AC 40 ms
55,696 KB
testcase_07 AC 41 ms
55,696 KB
testcase_08 AC 41 ms
55,696 KB
testcase_09 AC 41 ms
55,696 KB
testcase_10 AC 40 ms
55,696 KB
testcase_11 AC 40 ms
55,696 KB
testcase_12 AC 42 ms
55,696 KB
testcase_13 AC 276 ms
211,216 KB
testcase_14 AC 110 ms
112,840 KB
testcase_15 AC 227 ms
170,132 KB
testcase_16 AC 211 ms
170,184 KB
testcase_17 AC 213 ms
147,240 KB
testcase_18 AC 193 ms
139,108 KB
testcase_19 AC 172 ms
112,592 KB
testcase_20 AC 164 ms
111,396 KB
testcase_21 AC 237 ms
167,556 KB
testcase_22 AC 62 ms
79,804 KB
testcase_23 AC 183 ms
136,652 KB
testcase_24 AC 107 ms
106,160 KB
testcase_25 AC 59 ms
76,888 KB
testcase_26 AC 196 ms
149,180 KB
testcase_27 AC 58 ms
78,304 KB
testcase_28 AC 67 ms
80,876 KB
testcase_29 AC 95 ms
101,916 KB
testcase_30 AC 78 ms
89,564 KB
testcase_31 AC 177 ms
140,252 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

from collections import defaultdict
import math
import sys
input = sys.stdin.readline
N, M = map(int, input().split())
A = list(map(int, input().split()))
if M%2==1:
    print(0)
    exit()
D = defaultdict(int)
for a in A:
    D[a%M] += 1
ans = 0
used = set()
for a in D:
    na = a + M//2
    na %= M
    if a in used:
        continue
    if na in used:
        continue
    if na not in D:
        continue
    ans += D[a]*D[na]*(N-D[a]-D[na])
    used.add(a)
    used.add(na)
print(ans)
0