結果

問題 No.1679 マスゲーム
ユーザー tktk_snsn
提出日時 2021-09-14 19:00:19
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
AC  
実行時間 468 ms / 2,000 ms
コード長 360 bytes
コンパイル時間 78 ms
コンパイル使用メモリ 12,544 KB
実行使用メモリ 26,568 KB
最終ジャッジ日時 2024-06-27 09:45:46
合計ジャッジ時間 8,562 ms
ジャッジサーバーID
(参考情報)
judge2 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 25
権限があれば一括ダウンロードができます

ソースコード

diff #

from collections import defaultdict
import sys
input = sys.stdin.buffer.readline
sys.setrecursionlimit(10 ** 7)


N = int(input())
X = defaultdict(int)
Y = defaultdict(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