結果

問題 No.1679 マスゲーム
ユーザー syunsuke1024
提出日時 2021-09-19 15:51:17
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 286 ms / 2,000 ms
コード長 328 bytes
コンパイル時間 258 ms
コンパイル使用メモリ 82,944 KB
実行使用メモリ 94,308 KB
最終ジャッジ日時 2024-07-01 19:12:06
合計ジャッジ時間 6,888 ms
ジャッジサーバーID
(参考情報)
judge5 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 25
権限があれば一括ダウンロードができます

ソースコード

diff #

N = int(input())

R = {}
B = {}

for i in range(N):
    c,a,b = map(int,input().split())
    if c:
        if a-b not in R:
            R[a-b] = 0
        R[a-b] += 1
    else:
        if a-b not in B:
            B[a-b] = 0
        B[a-b] += 1

ans = 0
for k,v in R.items():
    if k in B:
        ans += R[k] * B[k]
print(ans)
0