結果

問題 No.723 2つの数の和
ユーザー rookzenorookzeno
提出日時 2018-08-03 22:36:12
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 184 ms / 2,000 ms
コード長 244 bytes
コンパイル時間 512 ms
コンパイル使用メモリ 11,812 KB
実行使用メモリ 27,560 KB
最終ジャッジ日時 2023-10-19 21:29:08
合計ジャッジ時間 3,816 ms
ジャッジサーバーID
(参考情報)
judge15 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 30 ms
10,140 KB
testcase_01 AC 30 ms
10,140 KB
testcase_02 AC 29 ms
10,140 KB
testcase_03 AC 147 ms
19,464 KB
testcase_04 AC 178 ms
21,476 KB
testcase_05 AC 166 ms
20,736 KB
testcase_06 AC 175 ms
20,908 KB
testcase_07 AC 94 ms
15,296 KB
testcase_08 AC 101 ms
16,136 KB
testcase_09 AC 180 ms
21,624 KB
testcase_10 AC 88 ms
15,600 KB
testcase_11 AC 41 ms
11,524 KB
testcase_12 AC 114 ms
16,752 KB
testcase_13 AC 184 ms
21,572 KB
testcase_14 AC 67 ms
13,528 KB
testcase_15 AC 102 ms
15,616 KB
testcase_16 AC 129 ms
18,616 KB
testcase_17 AC 162 ms
20,620 KB
testcase_18 AC 54 ms
11,932 KB
testcase_19 AC 73 ms
21,652 KB
testcase_20 AC 30 ms
10,140 KB
testcase_21 AC 30 ms
10,140 KB
testcase_22 AC 29 ms
10,140 KB
testcase_23 AC 155 ms
27,560 KB
testcase_24 AC 79 ms
15,188 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

n,x = map(int,input().split())
a = list(map(int,input().split()))
a = sorted(a)
import collections
c = collections.Counter(a)
e = c.most_common()
ans = 0
for i in range(len(e)):
  b = e[i][0]
  d = x-b
  k = c[d]
  ans += e[i][1] * k
print(ans)
0