結果

問題 No.723 2つの数の和
ユーザー けむけむけむけむ
提出日時 2021-08-09 19:15:54
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 104 ms / 2,000 ms
コード長 301 bytes
コンパイル時間 413 ms
コンパイル使用メモリ 11,744 KB
実行使用メモリ 24,896 KB
最終ジャッジ日時 2023-10-21 16:57:36
合計ジャッジ時間 3,236 ms
ジャッジサーバーID
(参考情報)
judge12 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 29 ms
10,104 KB
testcase_01 AC 29 ms
10,104 KB
testcase_02 AC 29 ms
10,104 KB
testcase_03 AC 81 ms
18,612 KB
testcase_04 AC 98 ms
21,440 KB
testcase_05 AC 91 ms
19,648 KB
testcase_06 AC 96 ms
19,784 KB
testcase_07 AC 56 ms
15,012 KB
testcase_08 AC 60 ms
15,964 KB
testcase_09 AC 104 ms
21,720 KB
testcase_10 AC 54 ms
14,988 KB
testcase_11 AC 34 ms
11,344 KB
testcase_12 AC 66 ms
16,532 KB
testcase_13 AC 103 ms
21,540 KB
testcase_14 AC 44 ms
13,520 KB
testcase_15 AC 57 ms
15,192 KB
testcase_16 AC 75 ms
18,580 KB
testcase_17 AC 87 ms
20,432 KB
testcase_18 AC 64 ms
11,896 KB
testcase_19 AC 85 ms
21,616 KB
testcase_20 AC 28 ms
10,104 KB
testcase_21 AC 28 ms
10,104 KB
testcase_22 AC 29 ms
10,104 KB
testcase_23 AC 84 ms
24,896 KB
testcase_24 AC 49 ms
14,960 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

from collections import Counter

def calc(N, X, a):
    cnt = 0
    b = Counter(a)
    for i in range(N):
        cnt += b[X - a[i]]
    return cnt

def main():
    N, X = map(int, input().split())
    a = list(map(int, input().split()))
    print(calc(N, X, a))

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