結果

問題 No.2517 Right Triangles on Circle
ユーザー MasKoaTS
提出日時 2023-08-26 17:16:23
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 344 ms / 2,000 ms
コード長 492 bytes
コンパイル時間 189 ms
コンパイル使用メモリ 82,176 KB
実行使用メモリ 127,372 KB
最終ジャッジ日時 2024-12-25 16:20:19
合計ジャッジ時間 6,501 ms
ジャッジサーバーID
(参考情報)
judge2 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 29
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
input = sys.stdin.readline

n, m = map(int, input().split())
a = sorted(map(int, input().split()))

if(m & 1):
    exit(print(0))

ans = 0
for x in a:
    def bin_search(x):
        ok = 0
        ng = len(a)
        while(abs(ok - ng) > 1):
            mid = (ok + ng) // 2
            if(a[mid] <= x):
                ok = mid
            else:
                ng = mid
        return (a[ok] == x)
    if not(bin_search(x + m // 2)):
        continue
    ans += n - 2
print(ans)
0