結果
| 問題 |
No.875 Range Mindex Query
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2024-08-05 16:06:16 |
| 言語 | Rust (1.83.0 + proconio) |
| 結果 |
TLE
|
| 実行時間 | - |
| コード長 | 646 bytes |
| コンパイル時間 | 12,622 ms |
| コンパイル使用メモリ | 396,568 KB |
| 実行使用メモリ | 13,472 KB |
| 最終ジャッジ日時 | 2024-08-05 16:06:43 |
| 合計ジャッジ時間 | 24,786 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 1 |
| other | AC * 15 TLE * 1 -- * 2 |
コンパイルメッセージ
warning: unused imports: `HashMap`, `HashSet`
--> src/main.rs:1:24
|
1 | use std::collections::{HashMap, HashSet};
| ^^^^^^^ ^^^^^^^
|
= note: `#[warn(unused_imports)]` on by default
warning: variable does not need to be mutable
--> src/main.rs:18:17
|
18 | let mut min_index = a[l..=r]
| ----^^^^^^^^^
| |
| help: remove this `mut`
|
= note: `#[warn(unused_mut)]` on by default
ソースコード
use std::collections::{HashMap, HashSet};
fn main() {
proconio::input! {
n: usize,
q: usize,
mut a: [u64; n],
queries: [(u64, usize, usize); q],
}
for (q, l, r) in queries {
if q == 1 {
let l = l - 1;
let r = r - 1;
a.swap(l, r);
} else if q == 2 {
let l = l - 1;
let r = r - 1;
let mut min_index = a[l..=r]
.iter()
.enumerate()
.min_by_key(|(_, &a)| a)
.unwrap()
.0;
println!("{}", l + min_index + 1);
}
}
}