結果

問題 No.2517 Right Triangles on Circle
ユーザー prin_kemkem
提出日時 2023-10-28 19:37:41
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 242 ms / 2,000 ms
コード長 785 bytes
コンパイル時間 215 ms
コンパイル使用メモリ 82,984 KB
実行使用メモリ 135,496 KB
最終ジャッジ日時 2024-09-25 16:33:22
合計ジャッジ時間 6,308 ms
ジャッジサーバーID
(参考情報)
judge4 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 29
権限があれば一括ダウンロードができます

ソースコード

diff #

from collections import defaultdict, deque, Counter
import copy
from itertools import combinations, permutations, product, accumulate, groupby, chain
from heapq import heapify, heappop, heappush
import math
import bisect
from pprint import pprint
from random import randint
import sys
# sys.setrecursionlimit(200000)
input = lambda: sys.stdin.readline().rstrip('\n')
inf = float('inf')
mod1 = 10**9+7
mod2 = 998244353
def ceil_div(x, y): return -(-x//y)

#################################################

N, M = map(int, input().split())
A = list(map(int, input().split()))

A.sort()
j = 0
while j < N and 2*A[j] <= M:
    j += 1

k = j
ans = 0
for i in range(k):
    while j < N and 2*(A[j]-A[i]) < M:
        j += 1
    if j < N and 2*(A[j]-A[i]) == M:
        ans += N-2
print(ans)
0