結果

問題 No.365 ジェンガソート
ユーザー machikox
提出日時 2019-04-24 06:41:48
言語 Rust
(1.83.0 + proconio)
結果
WA  
実行時間 -
コード長 498 bytes
コンパイル時間 13,637 ms
コンパイル使用メモリ 378,308 KB
実行使用メモリ 5,248 KB
最終ジャッジ日時 2024-11-07 00:51:07
合計ジャッジ時間 15,873 ms
ジャッジサーバーID
(参考情報)
judge4 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 8 WA * 33
権限があれば一括ダウンロードができます

ソースコード

diff #

use std::io::{self, BufRead};

fn get_lines() -> Vec<String> {
    let stdin = io::stdin();
    let lines: Vec<String> = stdin.lock().lines().map(|l| l.unwrap()).collect();
    return lines;
}

fn main(){
    let s = &get_lines();
    let n: i32 = s[0].parse().unwrap();
    let a: Vec<i32> = s[1].split(' ').map(|x| x.parse().unwrap()).rev().collect();
    let mut c = a[0];
    for x in &a[1..] {
        if *x == c - 1 {
            c -= 1;
        }
    }
    println!("{}", n - (a[0] - c));
}
0