結果

問題 No.365 ジェンガソート
ユーザー tabataba
提出日時 2024-08-06 11:41:44
言語 Rust
(1.77.0)
結果
WA  
実行時間 -
コード長 868 bytes
コンパイル時間 12,447 ms
コンパイル使用メモリ 396,260 KB
実行使用メモリ 10,624 KB
最終ジャッジ日時 2024-08-06 11:42:06
合計ジャッジ時間 17,550 ms
ジャッジサーバーID
(参考情報)
judge5 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
10,624 KB
testcase_01 AC 1 ms
5,248 KB
testcase_02 AC 1 ms
5,248 KB
testcase_03 AC 1 ms
5,376 KB
testcase_04 WA -
testcase_05 AC 1 ms
5,376 KB
testcase_06 AC 1 ms
5,376 KB
testcase_07 AC 1 ms
5,376 KB
testcase_08 WA -
testcase_09 AC 1 ms
5,376 KB
testcase_10 WA -
testcase_11 WA -
testcase_12 WA -
testcase_13 WA -
testcase_14 AC 2 ms
5,376 KB
testcase_15 AC 6 ms
5,376 KB
testcase_16 TLE -
testcase_17 -- -
testcase_18 -- -
testcase_19 -- -
testcase_20 -- -
testcase_21 -- -
testcase_22 -- -
testcase_23 -- -
testcase_24 -- -
testcase_25 -- -
testcase_26 -- -
testcase_27 -- -
testcase_28 -- -
testcase_29 -- -
testcase_30 -- -
testcase_31 -- -
testcase_32 -- -
testcase_33 -- -
testcase_34 -- -
testcase_35 -- -
testcase_36 -- -
testcase_37 -- -
testcase_38 -- -
testcase_39 -- -
testcase_40 -- -
権限があれば一括ダウンロードができます
コンパイルメッセージ
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;
  |     ^^^^^^^^^^^^^^^^^^^^^^^

ソースコード

diff #

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:?}");
    }
}
0