結果
問題 |
No.123 カードシャッフル
|
ユーザー |
![]() |
提出日時 | 2016-02-21 20:15:42 |
言語 | D (dmd 2.109.1) |
結果 |
AC
|
実行時間 | 24 ms / 5,000 ms |
コード長 | 449 bytes |
コンパイル時間 | 743 ms |
コンパイル使用メモリ | 103,552 KB |
実行使用メモリ | 5,508 KB |
最終ジャッジ日時 | 2024-06-12 02:57:39 |
合計ジャッジ時間 | 1,517 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 10 |
ソースコード
import std.stdio, std.conv, std.string, std.range, std.math, std.algorithm; void main() { auto input = readln.split.to!(int[]); auto N = input[0], M = input[1]; auto A = readln.split.to!(int[]); auto card = 1.iota(N + 1).array; foreach (i; 0 .. M) { auto tmp = card[A[i] - 1]; card[1 .. A[i]] = card[0 .. A[i] - 1].dup; card[0] = tmp; } card[0].writeln; }