結果

問題 No.1679 マスゲーム
ユーザー syunsuke1024syunsuke1024
提出日時 2021-09-19 15:51:17
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 294 ms / 2,000 ms
コード長 328 bytes
コンパイル時間 306 ms
コンパイル使用メモリ 86,732 KB
実行使用メモリ 95,800 KB
最終ジャッジ日時 2023-09-14 11:44:24
合計ジャッジ時間 6,971 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 71 ms
71,240 KB
testcase_01 AC 70 ms
70,936 KB
testcase_02 AC 71 ms
71,284 KB
testcase_03 AC 289 ms
95,800 KB
testcase_04 AC 285 ms
95,604 KB
testcase_05 AC 290 ms
95,748 KB
testcase_06 AC 290 ms
95,624 KB
testcase_07 AC 292 ms
95,480 KB
testcase_08 AC 290 ms
95,448 KB
testcase_09 AC 294 ms
95,564 KB
testcase_10 AC 291 ms
95,244 KB
testcase_11 AC 288 ms
95,692 KB
testcase_12 AC 112 ms
78,084 KB
testcase_13 AC 165 ms
83,552 KB
testcase_14 AC 285 ms
94,796 KB
testcase_15 AC 253 ms
92,780 KB
testcase_16 AC 230 ms
90,300 KB
testcase_17 AC 69 ms
71,072 KB
testcase_18 AC 187 ms
77,140 KB
testcase_19 AC 75 ms
71,088 KB
testcase_20 AC 74 ms
71,276 KB
testcase_21 AC 82 ms
75,464 KB
testcase_22 AC 78 ms
70,924 KB
testcase_23 AC 70 ms
71,324 KB
testcase_24 AC 76 ms
71,328 KB
testcase_25 AC 78 ms
71,128 KB
testcase_26 AC 76 ms
71,212 KB
testcase_27 AC 76 ms
71,168 KB
権限があれば一括ダウンロードができます

ソースコード

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