結果

問題 No.2517 Right Triangles on Circle
ユーザー akebono03akebono03
提出日時 2023-10-27 22:12:06
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 363 ms / 2,000 ms
コード長 526 bytes
コンパイル時間 510 ms
コンパイル使用メモリ 81,848 KB
実行使用メモリ 247,436 KB
最終ジャッジ日時 2023-10-27 22:12:13
合計ジャッジ時間 6,518 ms
ジャッジサーバーID
(参考情報)
judge14 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 38 ms
55,516 KB
testcase_01 AC 30 ms
53,396 KB
testcase_02 AC 38 ms
55,516 KB
testcase_03 AC 31 ms
53,396 KB
testcase_04 AC 35 ms
55,516 KB
testcase_05 AC 35 ms
55,516 KB
testcase_06 AC 34 ms
55,516 KB
testcase_07 AC 33 ms
55,516 KB
testcase_08 AC 34 ms
55,516 KB
testcase_09 AC 34 ms
55,516 KB
testcase_10 AC 33 ms
55,516 KB
testcase_11 AC 41 ms
55,516 KB
testcase_12 AC 34 ms
55,516 KB
testcase_13 AC 317 ms
244,708 KB
testcase_14 AC 115 ms
109,500 KB
testcase_15 AC 345 ms
235,716 KB
testcase_16 AC 363 ms
236,120 KB
testcase_17 AC 295 ms
247,436 KB
testcase_18 AC 267 ms
222,348 KB
testcase_19 AC 233 ms
206,432 KB
testcase_20 AC 237 ms
206,708 KB
testcase_21 AC 362 ms
246,464 KB
testcase_22 AC 50 ms
78,312 KB
testcase_23 AC 266 ms
244,756 KB
testcase_24 AC 145 ms
124,672 KB
testcase_25 AC 47 ms
75,276 KB
testcase_26 AC 306 ms
231,436 KB
testcase_27 AC 50 ms
76,760 KB
testcase_28 AC 91 ms
103,480 KB
testcase_29 AC 148 ms
124,792 KB
testcase_30 AC 109 ms
114,580 KB
testcase_31 AC 262 ms
244,880 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

def ip():return int(input())
def mp():return map(int, input().split())
def lmp():return list(map(int, input().split()))
N, M = mp()
A = lmp()
if M % 2 == 1:
    exit(print(0))
from collections import defaultdict
cnt = defaultdict(int)
for i in range(N):
    cnt[A[i]] = i+1
    cnt[A[i]+M] = N+i+1
from itertools import accumulate
A.sort()
cum = [0] + list(accumulate(A+A))
ans = 0
from bisect import bisect_left
M2 = M//2
for a in A:
    if cnt[a+M2]:
        ans += cnt[a+M2] - cnt[a] - 1
        # print(a, ans)
print(ans)
0