結果

問題 No.1679 マスゲーム
ユーザー NatsubiSoganNatsubiSogan
提出日時 2021-09-10 21:15:31
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 309 ms / 2,000 ms
コード長 480 bytes
コンパイル時間 1,282 ms
コンパイル使用メモリ 86,536 KB
実行使用メモリ 101,436 KB
最終ジャッジ日時 2023-09-05 05:31:16
合計ジャッジ時間 9,139 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 101 ms
71,816 KB
testcase_01 AC 101 ms
71,756 KB
testcase_02 AC 100 ms
71,844 KB
testcase_03 AC 309 ms
101,436 KB
testcase_04 AC 290 ms
100,984 KB
testcase_05 AC 288 ms
100,336 KB
testcase_06 AC 289 ms
100,748 KB
testcase_07 AC 297 ms
101,092 KB
testcase_08 AC 295 ms
100,332 KB
testcase_09 AC 293 ms
101,108 KB
testcase_10 AC 296 ms
101,036 KB
testcase_11 AC 291 ms
100,776 KB
testcase_12 AC 144 ms
79,520 KB
testcase_13 AC 191 ms
87,196 KB
testcase_14 AC 292 ms
100,488 KB
testcase_15 AC 262 ms
96,860 KB
testcase_16 AC 241 ms
95,124 KB
testcase_17 AC 98 ms
71,548 KB
testcase_18 AC 224 ms
82,116 KB
testcase_19 AC 106 ms
72,320 KB
testcase_20 AC 106 ms
72,228 KB
testcase_21 AC 120 ms
76,240 KB
testcase_22 AC 113 ms
72,292 KB
testcase_23 AC 100 ms
71,688 KB
testcase_24 AC 105 ms
72,296 KB
testcase_25 AC 111 ms
72,160 KB
testcase_26 AC 105 ms
71,988 KB
testcase_27 AC 110 ms
72,360 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

from collections import defaultdict

n = int(input())

red_d = defaultdict(int) # 赤い点の B_i - T_i を記録する
blue_l = [] # 青い点の B_j - T_j を保存する

for _ in range(n):
    a, b, t = map(int, input().split())
    if a == 0:
        red_d[b - t] += 1
    else:
        blue_l.append(b - t)
    
ans = 0 # 答え

for i in blue_l: # 青い点すべてについて、B_j - T_j = B_i = T_i なる i の数を数えて足す
    ans += red_d[i]
    
print(ans)
0