結果
| 問題 | 
                            No.1679 マスゲーム
                             | 
                    
| ユーザー | 
                             | 
                    
| 提出日時 | 2022-01-29 18:22:09 | 
| 言語 | Python3  (3.13.1 + numpy 2.2.1 + scipy 1.14.1)  | 
                    
| 結果 | 
                             
                                AC
                                 
                             
                            
                         | 
                    
| 実行時間 | 730 ms / 2,000 ms | 
| コード長 | 249 bytes | 
| コンパイル時間 | 278 ms | 
| コンパイル使用メモリ | 12,288 KB | 
| 実行使用メモリ | 24,656 KB | 
| 最終ジャッジ日時 | 2025-01-02 12:09:28 | 
| 合計ジャッジ時間 | 12,521 ms | 
| 
                            ジャッジサーバーID (参考情報)  | 
                        judge3 / judge5 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 3 | 
| other | AC * 25 | 
ソースコード
from collections import defaultdict
n=int(input())
red=defaultdict(int)
blue=[]
for _ in range(n):
    a,b,t=map(int,input().split())
    if a==0:
        red[b-t]+=1
    else:
        blue.append(b-t)
ans=0
for i in blue:
    ans+=red[i]
print(ans)