結果

問題 No.723 2つの数の和
ユーザー flippergoflippergo
提出日時 2020-12-26 12:59:09
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 81 ms / 2,000 ms
コード長 301 bytes
コンパイル時間 612 ms
コンパイル使用メモリ 81,708 KB
実行使用メモリ 98,556 KB
最終ジャッジ日時 2023-10-24 20:56:26
合計ジャッジ時間 2,907 ms
ジャッジサーバーID
(参考情報)
judge11 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 34 ms
53,396 KB
testcase_01 AC 33 ms
53,396 KB
testcase_02 AC 34 ms
53,396 KB
testcase_03 AC 67 ms
84,320 KB
testcase_04 AC 81 ms
92,948 KB
testcase_05 AC 74 ms
91,220 KB
testcase_06 AC 75 ms
91,332 KB
testcase_07 AC 57 ms
76,152 KB
testcase_08 AC 57 ms
77,560 KB
testcase_09 AC 75 ms
93,020 KB
testcase_10 AC 55 ms
73,500 KB
testcase_11 AC 44 ms
64,372 KB
testcase_12 AC 60 ms
80,036 KB
testcase_13 AC 74 ms
93,096 KB
testcase_14 AC 48 ms
69,892 KB
testcase_15 AC 54 ms
74,792 KB
testcase_16 AC 66 ms
83,056 KB
testcase_17 AC 70 ms
90,132 KB
testcase_18 AC 59 ms
80,996 KB
testcase_19 AC 62 ms
84,452 KB
testcase_20 AC 34 ms
53,404 KB
testcase_21 AC 33 ms
53,404 KB
testcase_22 AC 32 ms
53,404 KB
testcase_23 AC 76 ms
98,556 KB
testcase_24 AC 52 ms
71,276 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

N,X = map(int,input().split())
A = list(map(int,input().split()))
C = {}
for i in range(N):
    if A[i] not in C:
        C[A[i]] = 0
    C[A[i]] += 1
cnt = 0
for i in range(N):
    a = A[i]
    if X-a in C:
        if X-a!=a:
            cnt += C[X-a]
        else:
            cnt += C[a]
print(cnt)
0