結果

問題 No.723 2つの数の和
ユーザー ikdikd
提出日時 2018-08-03 23:22:52
言語 Nim
(2.0.2)
結果
AC  
実行時間 29 ms / 2,000 ms
コード長 283 bytes
コンパイル時間 3,025 ms
コンパイル使用メモリ 68,832 KB
実行使用メモリ 14,456 KB
最終ジャッジ日時 2023-09-13 19:02:42
合計ジャッジ時間 4,685 ms
ジャッジサーバーID
(参考情報)
judge12 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,380 KB
testcase_01 AC 2 ms
4,376 KB
testcase_02 AC 2 ms
4,376 KB
testcase_03 AC 18 ms
10,376 KB
testcase_04 AC 22 ms
11,160 KB
testcase_05 AC 20 ms
11,016 KB
testcase_06 AC 22 ms
11,024 KB
testcase_07 AC 10 ms
7,136 KB
testcase_08 AC 13 ms
8,376 KB
testcase_09 AC 22 ms
11,300 KB
testcase_10 AC 9 ms
6,808 KB
testcase_11 AC 4 ms
4,376 KB
testcase_12 AC 15 ms
8,724 KB
testcase_13 AC 26 ms
14,308 KB
testcase_14 AC 7 ms
5,604 KB
testcase_15 AC 11 ms
8,308 KB
testcase_16 AC 16 ms
9,624 KB
testcase_17 AC 20 ms
10,836 KB
testcase_18 AC 19 ms
13,020 KB
testcase_19 AC 29 ms
14,456 KB
testcase_20 AC 2 ms
4,376 KB
testcase_21 AC 2 ms
4,376 KB
testcase_22 AC 2 ms
4,380 KB
testcase_23 AC 24 ms
12,940 KB
testcase_24 AC 7 ms
5,892 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import strutils, sequtils

var
  args=stdin.readLine.split.map(parseInt)
  (n, x)=(args[0], args[1])
  a=stdin.readLine.split.map(parseInt)

var freq=newSeq[int64](100000+1)
for v in a: freq[v]+=1
var tot:int64=0
for v in a:
  if 0<=x-v and x-v<=100000:
    tot+=freq[x-v]
echo tot

0