結果

問題 No.365 ジェンガソート
コンテスト
ユーザー machikox
提出日時 2019-04-24 07:27:36
言語 Rust
(1.97.1 + proconio + num + itertools + ACL)
コンパイル:
/usr/bin/rustc_custom
実行:
./target/release/main
結果
AC  
実行時間 3 ms / 2,000 ms
+ 351µs
コード長 494 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 1,376 ms
コンパイル使用メモリ 190,352 KB
実行使用メモリ 10,044 KB
最終ジャッジ日時 2026-09-19 23:11:17
合計ジャッジ時間 4,115 ms
ジャッジサーバーID
(参考情報)
judge2_0 / judge1_1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 41
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

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 mut a = s[1].split(' ').map(|x| x.parse::<i32>().unwrap()).rev();
    a.position(|x| x == n);
    let mut c = n - 1;
    for x in a {
        if x == c {
            c -= 1;
        }
    }
    println!("{}", c);
}
0