結果

問題 No.723 2つの数の和
ユーザー tails1434tails1434
提出日時 2020-01-15 21:52:56
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 160 ms / 2,000 ms
コード長 310 bytes
コンパイル時間 418 ms
コンパイル使用メモリ 87,184 KB
実行使用メモリ 109,644 KB
最終ジャッジ日時 2023-09-02 15:22:50
合計ジャッジ時間 5,416 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 96 ms
71,712 KB
testcase_01 AC 101 ms
71,484 KB
testcase_02 AC 95 ms
71,864 KB
testcase_03 AC 144 ms
99,368 KB
testcase_04 AC 153 ms
105,880 KB
testcase_05 AC 152 ms
105,708 KB
testcase_06 AC 153 ms
103,952 KB
testcase_07 AC 126 ms
90,148 KB
testcase_08 AC 132 ms
91,972 KB
testcase_09 AC 160 ms
107,488 KB
testcase_10 AC 126 ms
88,876 KB
testcase_11 AC 108 ms
78,648 KB
testcase_12 AC 131 ms
94,732 KB
testcase_13 AC 157 ms
109,644 KB
testcase_14 AC 117 ms
84,308 KB
testcase_15 AC 129 ms
92,016 KB
testcase_16 AC 142 ms
99,528 KB
testcase_17 AC 149 ms
105,596 KB
testcase_18 AC 120 ms
89,564 KB
testcase_19 AC 122 ms
91,520 KB
testcase_20 AC 92 ms
71,636 KB
testcase_21 AC 92 ms
71,620 KB
testcase_22 AC 95 ms
71,828 KB
testcase_23 AC 143 ms
105,768 KB
testcase_24 AC 119 ms
86,792 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

from collections import defaultdict

def main():
    N, X = map(int, input().split())
    A = list(map(int, input().split()))
    d = defaultdict(int)
    for a in A:
        d[a] += 1
    ans = 0
    for a in A:
        tmp = X - a
        ans += d[tmp]
    print(ans)



if __name__ == "__main__":
    main()
0