結果
| 問題 | No.365 ジェンガソート | 
| コンテスト | |
| ユーザー |  | 
| 提出日時 | 2024-08-06 11:41:44 | 
| 言語 | Rust (1.83.0 + proconio) | 
| 結果 | 
                                WA
                                 
                             | 
| 実行時間 | - | 
| コード長 | 868 bytes | 
| コンパイル時間 | 12,447 ms | 
| コンパイル使用メモリ | 396,260 KB | 
| 実行使用メモリ | 10,624 KB | 
| 最終ジャッジ日時 | 2024-08-06 11:42:06 | 
| 合計ジャッジ時間 | 17,550 ms | 
| ジャッジサーバーID (参考情報) | judge5 / judge3 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| other | AC * 10 WA * 6 TLE * 1 -- * 24 | 
コンパイルメッセージ
warning: unused imports: `BTreeSet`, `HashMap`, `HashSet`
 --> 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 a = VecDeque::from(a);
    a.iter_mut().for_each(|x| *x -= 1);
    for i in 0.. {
        while a[a.len() - 1] == a.len() - 1 {
            a.pop_back();
            if a.is_empty() {
                println!("{}", i);
                return;
            }
        }
        let max_index = a.iter().enumerate().max_by_key(|x| x.1).unwrap().0;
        let index = a
            .iter()
            .enumerate()
            .skip(max_index + 1)
            .max_by_key(|x| x.1)
            .unwrap()
            .0;
        eprintln!("{} {}", max_index, index);
        let value = a[index];
        a.remove(index);
        a.push_front(value);
        eprintln!("{a:?}");
    }
}
            
            
            
        