結果

問題 No.723 2つの数の和
ユーザー toshiro_yanagitoshiro_yanagi
提出日時 2018-08-25 13:57:41
言語 Nim
(2.0.2)
結果
WA  
実行時間 -
コード長 368 bytes
コンパイル時間 3,358 ms
コンパイル使用メモリ 68,960 KB
実行使用メモリ 29,872 KB
最終ジャッジ日時 2023-09-13 19:15:04
合計ジャッジ時間 4,892 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,376 KB
testcase_01 AC 2 ms
4,376 KB
testcase_02 AC 2 ms
4,376 KB
testcase_03 WA -
testcase_04 WA -
testcase_05 WA -
testcase_06 WA -
testcase_07 WA -
testcase_08 WA -
testcase_09 WA -
testcase_10 WA -
testcase_11 WA -
testcase_12 WA -
testcase_13 AC 41 ms
20,012 KB
testcase_14 AC 11 ms
6,976 KB
testcase_15 AC 18 ms
10,772 KB
testcase_16 AC 32 ms
16,860 KB
testcase_17 AC 37 ms
18,272 KB
testcase_18 AC 21 ms
12,216 KB
testcase_19 AC 25 ms
12,228 KB
testcase_20 AC 2 ms
4,380 KB
testcase_21 AC 1 ms
4,376 KB
testcase_22 AC 2 ms
4,380 KB
testcase_23 AC 55 ms
29,872 KB
testcase_24 WA -
権限があれば一括ダウンロードができます
コンパイルメッセージ
/home/judge/data/code/Main.nim(8, 7) Warning: Deprecated since v0.20, use 'initHashSet'; initSet is deprecated [Deprecated]

ソースコード

diff #

import strutils, sequtils, tables, sets

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

for i, ai in arr:
  inc a, ai
  incl b, ai

for k, v in a:
  if j * 2 >= a.len: break

  if X - k in a:
    ans += a[k] * a[X - k] * (2 - int(k == X - k))
  j += 1

echo ans
0