結果
| 問題 |
No.318 学学学学学
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2024-07-31 14:34:43 |
| 言語 | Rust (1.83.0 + proconio) |
| 結果 |
TLE
|
| 実行時間 | - |
| コード長 | 841 bytes |
| コンパイル時間 | 12,875 ms |
| コンパイル使用メモリ | 386,500 KB |
| 実行使用メモリ | 12,700 KB |
| 最終ジャッジ日時 | 2024-07-31 14:35:01 |
| 合計ジャッジ時間 | 17,813 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | -- * 3 |
| other | AC * 6 TLE * 1 -- * 19 |
コンパイルメッセージ
warning: unused imports: `HashMap`, `HashSet`, `VecDeque`, `fmt::Debug`, `io::stdin`, `str::FromStr`, `sync::OnceLock`
--> src/main.rs:2:29
|
2 | collections::{BTreeSet, HashMap, HashSet, VecDeque},
| ^^^^^^^ ^^^^^^^ ^^^^^^^^
3 | fmt::Debug,
| ^^^^^^^^^^
4 | io::stdin,
| ^^^^^^^^^
5 | str::FromStr,
| ^^^^^^^^^^^^
6 | sync::OnceLock,
| ^^^^^^^^^^^^^^
|
= note: `#[warn(unused_imports)]` on by default
warning: unused import: `proconio::marker::Chars`
--> src/main.rs:9:5
|
9 | use proconio::marker::Chars;
| ^^^^^^^^^^^^^^^^^^^^^^^
ソースコード
use std::{
collections::{BTreeSet, HashMap, HashSet, VecDeque},
fmt::Debug,
io::stdin,
str::FromStr,
sync::OnceLock,
};
use proconio::marker::Chars;
fn main() {
proconio::input! {
n: u64,
a: [u64; n],
}
let mut s = a.clone();
s.sort_unstable();
let s = s
.windows(2)
.filter(|s| s[0] == s[1])
.map(|s| s[0])
.collect::<BTreeSet<u64>>();
let mut r = a.clone();
for s in s {
let first = a.iter().position(|a| *a == s).unwrap();
let last = a.iter().rposition(|a| *a == s).unwrap();
for i in first..=last {
r[i] = std::cmp::max(r[i], s);
}
}
println!(
"{}",
r.into_iter()
.map(|r| format!("{r}"))
.collect::<Vec<String>>()
.join(" ")
);
}