結果
| 問題 | No.365 ジェンガソート | 
| コンテスト | |
| ユーザー |  | 
| 提出日時 | 2024-08-06 11:49:44 | 
| 言語 | Rust (1.83.0 + proconio) | 
| 結果 | 
                                AC
                                 
                             | 
| 実行時間 | 5 ms / 2,000 ms | 
| コード長 | 447 bytes | 
| コンパイル時間 | 12,258 ms | 
| コンパイル使用メモリ | 394,240 KB | 
| 実行使用メモリ | 6,944 KB | 
| 最終ジャッジ日時 | 2024-08-06 11:50:00 | 
| 合計ジャッジ時間 | 14,178 ms | 
| ジャッジサーバーID (参考情報) | judge5 / judge2 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| other | AC * 41 | 
コンパイルメッセージ
warning: unused imports: `BTreeSet`, `HashMap`, `HashSet`, `VecDeque`
 --> src/main.rs:1:24
  |
1 | use std::collections::{BTreeSet, HashMap, HashSet, VecDeque};
  |                        ^^^^^^^^  ^^^^^^^  ^^^^^^^  ^^^^^^^^
  |
  = note: `#[warn(unused_imports)]` on by default
warning: unused import: `proconio::marker::Chars`
 --> src/main.rs:3:5
  |
3 | use proconio::marker::Chars;
  |     ^^^^^^^^^^^^^^^^^^^^^^^
            
            ソースコード
use std::collections::{BTreeSet, HashMap, HashSet, VecDeque};
use proconio::marker::Chars;
fn main() {
    proconio::input! {
        n: usize,
        a: [usize; n],
    }
    let mut x = n;
    let s = a
        .iter()
        .rev()
        .filter(|&a| {
            if *a == x {
                x -= 1;
                true
            } else {
                false
            }
        })
        .count();
    println!("{}", n - s);
}
            
            
            
        