結果

問題 No.723 2つの数の和
ユーザー lloyzlloyz
提出日時 2022-06-04 11:45:33
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 124 ms / 2,000 ms
コード長 258 bytes
コンパイル時間 93 ms
コンパイル使用メモリ 11,704 KB
実行使用メモリ 27,632 KB
最終ジャッジ日時 2023-10-21 02:37:27
合計ジャッジ時間 2,987 ms
ジャッジサーバーID
(参考情報)
judge11 / judge10
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 30 ms
10,008 KB
testcase_01 AC 30 ms
10,008 KB
testcase_02 AC 30 ms
10,008 KB
testcase_03 AC 86 ms
19,336 KB
testcase_04 AC 109 ms
21,344 KB
testcase_05 AC 92 ms
19,692 KB
testcase_06 AC 102 ms
20,120 KB
testcase_07 AC 62 ms
16,668 KB
testcase_08 AC 67 ms
17,236 KB
testcase_09 AC 103 ms
21,620 KB
testcase_10 AC 61 ms
16,472 KB
testcase_11 AC 35 ms
11,508 KB
testcase_12 AC 69 ms
17,796 KB
testcase_13 AC 97 ms
21,440 KB
testcase_14 AC 48 ms
15,372 KB
testcase_15 AC 61 ms
16,592 KB
testcase_16 AC 76 ms
19,016 KB
testcase_17 AC 90 ms
20,452 KB
testcase_18 AC 53 ms
11,800 KB
testcase_19 AC 70 ms
21,524 KB
testcase_20 AC 29 ms
10,008 KB
testcase_21 AC 29 ms
10,008 KB
testcase_22 AC 29 ms
10,008 KB
testcase_23 AC 124 ms
27,632 KB
testcase_24 AC 52 ms
16,616 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

from collections import Counter

n, x = map(int, input().split())
counter = Counter(list(map(int, input().split())))

ans = 0
vals = set(counter.keys())
for val, cnt in counter.items():
    if x - val in vals:
        ans += cnt * counter[x -val]
print(ans)
0