結果

問題 No.1679 マスゲーム
ユーザー NatsubiSogan
提出日時 2021-09-10 20:07:50
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
AC  
実行時間 806 ms / 2,000 ms
コード長 480 bytes
コンパイル時間 132 ms
コンパイル使用メモリ 12,672 KB
実行使用メモリ 25,120 KB
最終ジャッジ日時 2024-06-23 02:00:22
合計ジャッジ時間 12,099 ms
ジャッジサーバーID
(参考情報)
judge2 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 25
権限があれば一括ダウンロードができます

ソースコード

diff #

from collections import defaultdict

n = int(input())

red_d = defaultdict(int) # 赤い点の B_i - T_i を記録する
blue_l = [] # 青い点の B_j - T_j を保存する

for _ in range(n):
    a, b, t = map(int, input().split())
    if a == 0:
        red_d[b - t] += 1
    else:
        blue_l.append(b - t)
    
ans = 0 # 答え

for i in blue_l: # 青い点すべてについて、B_j - T_j = B_i = T_i なる i の数を数えて足す
    ans += red_d[i]
    
print(ans)
0