結果

問題 No.1679 マスゲーム
ユーザー rin204
提出日時 2021-09-24 17:28:41
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 280 ms / 2,000 ms
コード長 273 bytes
コンパイル時間 210 ms
コンパイル使用メモリ 82,296 KB
実行使用メモリ 103,204 KB
最終ジャッジ日時 2024-07-05 09:45:26
合計ジャッジ時間 6,661 ms
ジャッジサーバーID
(参考情報)
judge4 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 25
権限があれば一括ダウンロードができます

ソースコード

diff #

from collections import defaultdict as dd

n = int(input())
X = dd(int)
Y = dd(int)
for _ in range(n):
    a, b, t = map(int, input().split())
    if a == 0:
        X[b - t] += 1
    else:
        Y[b - t] += 1
ans = 0
for k, v in X.items():
    ans += v * Y[k]
print(ans)
0