結果
問題 | No.2482 Sandglasses |
ユーザー |
|
提出日時 | 2024-12-05 11:20:01 |
言語 | Rust (1.83.0 + proconio) |
結果 |
AC
|
実行時間 | 62 ms / 2,000 ms |
コード長 | 1,070 bytes |
コンパイル時間 | 18,897 ms |
コンパイル使用メモリ | 378,736 KB |
実行使用メモリ | 11,392 KB |
最終ジャッジ日時 | 2024-12-05 11:20:27 |
合計ジャッジ時間 | 23,658 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 25 |
ソースコード
#[allow(unused_imports)]use proconio::{input,marker::{Bytes, Chars, Usize1},};fn main() {input! {n: usize,k: i64,mut t: i64,a: [char; n],b: [i64; n],}t %= k * 2;let mut ord = (0..n).collect::<Vec<_>>();ord.sort_unstable_by_key(|&i| b[i]);let mut x = (0..n).map(|i| {let mut x = b[i];if a[i] == 'A' {x -= t;if x < 0 {x += (0 - x) * 2;}if x > k {x -= (x - k) * 2;}} else {x += t;if x > k {x -= (x - k) * 2;}if x < 0 {x += (0 - x) * 2;}}x}).collect::<Vec<_>>();x.sort_unstable();let mut res = vec![0; n];for i in 0..n {res[ord[i]] = x[i];}for r in res {print!("{} ", r);}println!();}