結果

問題 No.1679 マスゲーム
ユーザー NatsubiSoganNatsubiSogan
提出日時 2021-09-10 20:07:50
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 691 ms / 2,000 ms
コード長 480 bytes
コンパイル時間 339 ms
コンパイル使用メモリ 10,632 KB
実行使用メモリ 22,824 KB
最終ジャッジ日時 2023-09-05 05:31:29
合計ジャッジ時間 12,066 ms
ジャッジサーバーID
(参考情報)
judge11 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 18 ms
8,444 KB
testcase_01 AC 18 ms
8,516 KB
testcase_02 AC 18 ms
8,468 KB
testcase_03 AC 691 ms
22,692 KB
testcase_04 AC 690 ms
22,640 KB
testcase_05 AC 690 ms
22,680 KB
testcase_06 AC 688 ms
22,612 KB
testcase_07 AC 689 ms
22,636 KB
testcase_08 AC 684 ms
22,568 KB
testcase_09 AC 675 ms
22,632 KB
testcase_10 AC 685 ms
22,660 KB
testcase_11 AC 689 ms
22,620 KB
testcase_12 AC 76 ms
9,776 KB
testcase_13 AC 288 ms
14,980 KB
testcase_14 AC 690 ms
22,824 KB
testcase_15 AC 596 ms
21,560 KB
testcase_16 AC 512 ms
21,060 KB
testcase_17 AC 18 ms
8,624 KB
testcase_18 AC 611 ms
9,312 KB
testcase_19 AC 20 ms
8,532 KB
testcase_20 AC 19 ms
8,504 KB
testcase_21 AC 21 ms
8,680 KB
testcase_22 AC 21 ms
8,564 KB
testcase_23 AC 18 ms
8,552 KB
testcase_24 AC 20 ms
8,616 KB
testcase_25 AC 21 ms
8,540 KB
testcase_26 AC 19 ms
8,520 KB
testcase_27 AC 21 ms
8,588 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