結果

問題 No.123 カードシャッフル
ユーザー n_knuun_knuu
提出日時 2017-01-06 06:17:58
言語 Nim
(2.0.2)
結果
AC  
実行時間 98 ms / 5,000 ms
コード長 342 bytes
コンパイル時間 3,299 ms
コンパイル使用メモリ 71,412 KB
実行使用メモリ 13,244 KB
最終ジャッジ日時 2023-09-12 09:34:13
合計ジャッジ時間 4,475 ms
ジャッジサーバーID
(参考情報)
judge14 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,380 KB
testcase_01 AC 2 ms
4,376 KB
testcase_02 AC 1 ms
4,380 KB
testcase_03 AC 2 ms
4,376 KB
testcase_04 AC 1 ms
4,380 KB
testcase_05 AC 2 ms
4,380 KB
testcase_06 AC 2 ms
4,380 KB
testcase_07 AC 1 ms
4,380 KB
testcase_08 AC 2 ms
4,380 KB
testcase_09 AC 2 ms
4,376 KB
testcase_10 AC 31 ms
13,020 KB
testcase_11 AC 94 ms
13,232 KB
testcase_12 AC 98 ms
13,176 KB
testcase_13 AC 98 ms
13,244 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sequtils, strutils
let
  t = stdin.readline.split.map(parseInt)
  (N, M) = (t[0], t[1])
  A = stdin.readline.split.mapIt(it.parseInt-1)
var cards = newSeq[int](N)
for i in 0..<N:
  cards[i] = i+1
for a in A:
  var tmp = newSeq[int]()
  tmp.add(cards[a])
  for i, c in cards:
    if i != a:
      tmp.add(c)
  cards = tmp
cards[0].echo
0