結果

問題 No.1679 マスゲーム
ユーザー ryusukeryusuke
提出日時 2022-02-04 20:38:34
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 354 ms / 2,000 ms
コード長 390 bytes
コンパイル時間 480 ms
コンパイル使用メモリ 86,928 KB
実行使用メモリ 121,140 KB
最終ジャッジ日時 2023-09-02 04:22:23
合計ジャッジ時間 7,924 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 95 ms
71,712 KB
testcase_01 AC 93 ms
71,508 KB
testcase_02 AC 93 ms
71,760 KB
testcase_03 AC 344 ms
120,760 KB
testcase_04 AC 350 ms
120,956 KB
testcase_05 AC 348 ms
120,936 KB
testcase_06 AC 344 ms
120,968 KB
testcase_07 AC 347 ms
120,760 KB
testcase_08 AC 345 ms
120,928 KB
testcase_09 AC 344 ms
121,024 KB
testcase_10 AC 346 ms
121,140 KB
testcase_11 AC 343 ms
121,004 KB
testcase_12 AC 151 ms
80,876 KB
testcase_13 AC 219 ms
96,680 KB
testcase_14 AC 354 ms
121,072 KB
testcase_15 AC 321 ms
116,752 KB
testcase_16 AC 290 ms
110,572 KB
testcase_17 AC 99 ms
71,524 KB
testcase_18 AC 304 ms
97,664 KB
testcase_19 AC 108 ms
76,824 KB
testcase_20 AC 104 ms
76,820 KB
testcase_21 AC 113 ms
76,844 KB
testcase_22 AC 109 ms
76,488 KB
testcase_23 AC 96 ms
71,372 KB
testcase_24 AC 105 ms
76,672 KB
testcase_25 AC 111 ms
76,948 KB
testcase_26 AC 105 ms
76,716 KB
testcase_27 AC 108 ms
76,656 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

from collections import defaultdict

n = int(input())
abt = [list(map(int, input().split())) for _ in range(n)]

d = defaultdict(int)
for i in range(n):
    # 青の時のカウントをする
    if abt[i][0] == 1:
        d[abt[i][2] - abt[i][1]] += 1

ans = 0
for i in range(n):
    # 重なる赤を見つける
    if abt[i][0] == 0:
        ans += d[abt[i][2] - abt[i][1]]

print(ans)
0