結果

問題 No.723 2つの数の和
ユーザー toshiro_yanagitoshiro_yanagi
提出日時 2018-08-26 10:32:22
言語 Nim
(2.0.2)
結果
AC  
実行時間 48 ms / 2,000 ms
コード長 252 bytes
コンパイル時間 3,229 ms
コンパイル使用メモリ 68,896 KB
実行使用メモリ 20,112 KB
最終ジャッジ日時 2023-09-13 19:15:26
合計ジャッジ時間 4,915 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,376 KB
testcase_01 AC 2 ms
4,380 KB
testcase_02 AC 2 ms
4,380 KB
testcase_03 AC 31 ms
14,052 KB
testcase_04 AC 39 ms
15,612 KB
testcase_05 AC 36 ms
15,160 KB
testcase_06 AC 38 ms
15,880 KB
testcase_07 AC 16 ms
8,436 KB
testcase_08 AC 18 ms
9,124 KB
testcase_09 AC 39 ms
15,608 KB
testcase_10 AC 16 ms
8,104 KB
testcase_11 AC 5 ms
4,376 KB
testcase_12 AC 20 ms
9,388 KB
testcase_13 AC 41 ms
16,908 KB
testcase_14 AC 9 ms
5,860 KB
testcase_15 AC 17 ms
8,952 KB
testcase_16 AC 28 ms
12,700 KB
testcase_17 AC 35 ms
14,352 KB
testcase_18 AC 21 ms
12,168 KB
testcase_19 AC 26 ms
12,224 KB
testcase_20 AC 2 ms
4,380 KB
testcase_21 AC 2 ms
4,376 KB
testcase_22 AC 2 ms
4,376 KB
testcase_23 AC 48 ms
20,112 KB
testcase_24 AC 13 ms
7,656 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import strutils, sequtils, tables

let
  tmp, a = map(split readLine stdin, parseInt)
  (N, X) = (tmp[0], tmp[1])
var
  b = initCountTable[int]()
  ans = 0

for i, ai in a:
  inc b, ai

for k, v in b:
  if X - k in b:
    ans += v * b[X - k]

echo ans
0