結果

問題 No.365 ジェンガソート
ユーザー neko_the_shadowneko_the_shadow
提出日時 2024-02-14 16:32:31
言語 Rust
(1.77.0)
結果
AC  
実行時間 6 ms / 2,000 ms
コード長 476 bytes
コンパイル時間 822 ms
コンパイル使用メモリ 176,884 KB
実行使用メモリ 6,676 KB
最終ジャッジ日時 2024-02-14 16:32:35
合計ジャッジ時間 2,572 ms
ジャッジサーバーID
(参考情報)
judge11 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
6,676 KB
testcase_01 AC 1 ms
6,676 KB
testcase_02 AC 1 ms
6,676 KB
testcase_03 AC 1 ms
6,676 KB
testcase_04 AC 1 ms
6,676 KB
testcase_05 AC 1 ms
6,676 KB
testcase_06 AC 1 ms
6,676 KB
testcase_07 AC 1 ms
6,676 KB
testcase_08 AC 1 ms
6,676 KB
testcase_09 AC 1 ms
6,676 KB
testcase_10 AC 1 ms
6,676 KB
testcase_11 AC 1 ms
6,676 KB
testcase_12 AC 1 ms
6,676 KB
testcase_13 AC 1 ms
6,676 KB
testcase_14 AC 1 ms
6,676 KB
testcase_15 AC 1 ms
6,676 KB
testcase_16 AC 5 ms
6,676 KB
testcase_17 AC 6 ms
6,676 KB
testcase_18 AC 1 ms
6,676 KB
testcase_19 AC 6 ms
6,676 KB
testcase_20 AC 2 ms
6,676 KB
testcase_21 AC 2 ms
6,676 KB
testcase_22 AC 5 ms
6,676 KB
testcase_23 AC 3 ms
6,676 KB
testcase_24 AC 4 ms
6,676 KB
testcase_25 AC 2 ms
6,676 KB
testcase_26 AC 4 ms
6,676 KB
testcase_27 AC 6 ms
6,676 KB
testcase_28 AC 3 ms
6,676 KB
testcase_29 AC 5 ms
6,676 KB
testcase_30 AC 3 ms
6,676 KB
testcase_31 AC 2 ms
6,676 KB
testcase_32 AC 3 ms
6,676 KB
testcase_33 AC 6 ms
6,676 KB
testcase_34 AC 2 ms
6,676 KB
testcase_35 AC 4 ms
6,676 KB
testcase_36 AC 6 ms
6,676 KB
testcase_37 AC 6 ms
6,676 KB
testcase_38 AC 6 ms
6,676 KB
testcase_39 AC 6 ms
6,676 KB
testcase_40 AC 6 ms
6,676 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
warning: variable `N` should have a snake case name
 --> Main.rs:4:9
  |
4 |     let N = input().parse::<usize>().unwrap();
  |         ^ help: convert the identifier to snake case: `n`
  |
  = note: `#[warn(non_snake_case)]` on by default

warning: variable `A` should have a snake case name
 --> Main.rs:5:9
  |
5 |     let A = input().split_whitespace().map(|t| t.parse::<usize>().unwrap()).collect::<Vec<_>>();
  |         ^ help: convert the identifier to snake case: `a`

warning: 2 warnings emitted

ソースコード

diff #

use std::io::stdin;

fn main() {
    let N = input().parse::<usize>().unwrap();
    let A = input().split_whitespace().map(|t| t.parse::<usize>().unwrap()).collect::<Vec<_>>();

    let mut x = N;
    let mut c = 0;
    for &a in A.iter().rev() {
        if x==a {
            c += 1;
            x -= 1;
        }
    }
    println!("{}", N-c);
}

fn input() -> String {
    let mut buf = String::new();
    stdin().read_line(&mut buf).unwrap();
    buf.trim().to_string()
}
0