結果

問題 No.123 カードシャッフル
コンテスト
ユーザー iwot
提出日時 2020-06-03 19:34:57
言語 Rust
(1.99.1 + proconio + num + itertools + ACL)
コンパイル:
/usr/bin/rustc_custom
実行:
./target/release/main
結果
AC  
実行時間 5 ms / 5,000 ms
+ 403µs
コード長 582 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 558 ms
コンパイル使用メモリ 190,776 KB
実行使用メモリ 9,916 KB
最終ジャッジ日時 2026-09-29 19:08:12
合計ジャッジ時間 2,530 ms
ジャッジサーバーID
(参考情報)
judge1_0 / judge4_1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 10
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

fn read_vec<T: std::str::FromStr>() -> Vec<T> {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).ok();
    s.trim()
        .split_whitespace()
        .map(|e| e.parse().ok().unwrap())
        .collect()
}

fn main() {
  use std::collections::VecDeque;

  let nm:Vec<usize> = read_vec();
  let ops:Vec<usize> = read_vec();

  let mut sort:VecDeque<usize> = VecDeque::new();
  for i in 0..nm[0] {
    sort.push_back(i+1);
  }

  for i in 0..ops.len() {
    let temp = sort.remove(ops[i]-1).unwrap();
    sort.push_front(temp);
  }

  println!("{}", sort[0]);
}
0