結果

問題 No.1679 マスゲーム
ユーザー NatsubiSogan
提出日時 2021-09-10 21:15:31
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 249 ms / 2,000 ms
コード長 480 bytes
コンパイル時間 175 ms
コンパイル使用メモリ 82,560 KB
実行使用メモリ 100,592 KB
最終ジャッジ日時 2024-06-23 02:00:09
合計ジャッジ時間 6,352 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