結果
問題 | No.2592 おでぶなおばけさん 2 |
ユーザー | akakimidori |
提出日時 | 2023-12-20 00:16:53 |
言語 | Rust (1.77.0 + proconio) |
結果 |
AC
|
実行時間 | 256 ms / 2,500 ms |
コード長 | 2,997 bytes |
コンパイル時間 | 13,422 ms |
コンパイル使用メモリ | 402,828 KB |
実行使用メモリ | 10,648 KB |
最終ジャッジ日時 | 2024-09-27 09:32:09 |
合計ジャッジ時間 | 33,851 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge3 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 1 ms
6,820 KB |
testcase_01 | AC | 74 ms
6,816 KB |
testcase_02 | AC | 76 ms
6,944 KB |
testcase_03 | AC | 29 ms
6,944 KB |
testcase_04 | AC | 25 ms
6,940 KB |
testcase_05 | AC | 176 ms
6,944 KB |
testcase_06 | AC | 84 ms
6,940 KB |
testcase_07 | AC | 104 ms
6,940 KB |
testcase_08 | AC | 102 ms
6,944 KB |
testcase_09 | AC | 32 ms
6,940 KB |
testcase_10 | AC | 36 ms
6,940 KB |
testcase_11 | AC | 116 ms
6,944 KB |
testcase_12 | AC | 20 ms
6,944 KB |
testcase_13 | AC | 180 ms
8,832 KB |
testcase_14 | AC | 170 ms
8,964 KB |
testcase_15 | AC | 124 ms
7,812 KB |
testcase_16 | AC | 177 ms
8,960 KB |
testcase_17 | AC | 192 ms
9,344 KB |
testcase_18 | AC | 125 ms
7,936 KB |
testcase_19 | AC | 100 ms
7,296 KB |
testcase_20 | AC | 101 ms
7,296 KB |
testcase_21 | AC | 75 ms
6,944 KB |
testcase_22 | AC | 135 ms
7,808 KB |
testcase_23 | AC | 193 ms
9,472 KB |
testcase_24 | AC | 147 ms
8,448 KB |
testcase_25 | AC | 83 ms
6,940 KB |
testcase_26 | AC | 84 ms
6,944 KB |
testcase_27 | AC | 237 ms
10,496 KB |
testcase_28 | AC | 236 ms
10,496 KB |
testcase_29 | AC | 244 ms
10,624 KB |
testcase_30 | AC | 238 ms
10,624 KB |
testcase_31 | AC | 242 ms
10,520 KB |
testcase_32 | AC | 242 ms
10,648 KB |
testcase_33 | AC | 242 ms
10,388 KB |
testcase_34 | AC | 235 ms
10,368 KB |
testcase_35 | AC | 236 ms
10,496 KB |
testcase_36 | AC | 240 ms
10,624 KB |
testcase_37 | AC | 252 ms
10,496 KB |
testcase_38 | AC | 244 ms
10,496 KB |
testcase_39 | AC | 251 ms
10,368 KB |
testcase_40 | AC | 239 ms
10,496 KB |
testcase_41 | AC | 246 ms
10,368 KB |
testcase_42 | AC | 242 ms
10,496 KB |
testcase_43 | AC | 243 ms
10,496 KB |
testcase_44 | AC | 235 ms
10,624 KB |
testcase_45 | AC | 235 ms
10,496 KB |
testcase_46 | AC | 238 ms
10,496 KB |
testcase_47 | AC | 220 ms
9,600 KB |
testcase_48 | AC | 221 ms
9,600 KB |
testcase_49 | AC | 224 ms
9,600 KB |
testcase_50 | AC | 223 ms
9,600 KB |
testcase_51 | AC | 227 ms
9,600 KB |
testcase_52 | AC | 241 ms
10,368 KB |
testcase_53 | AC | 240 ms
10,496 KB |
testcase_54 | AC | 240 ms
10,496 KB |
testcase_55 | AC | 244 ms
10,368 KB |
testcase_56 | AC | 249 ms
10,496 KB |
testcase_57 | AC | 155 ms
6,944 KB |
testcase_58 | AC | 248 ms
10,496 KB |
testcase_59 | AC | 237 ms
10,496 KB |
testcase_60 | AC | 238 ms
10,496 KB |
testcase_61 | AC | 238 ms
10,496 KB |
testcase_62 | AC | 243 ms
10,496 KB |
testcase_63 | AC | 241 ms
10,500 KB |
testcase_64 | AC | 240 ms
10,368 KB |
testcase_65 | AC | 235 ms
10,240 KB |
testcase_66 | AC | 234 ms
10,240 KB |
testcase_67 | AC | 235 ms
10,112 KB |
testcase_68 | AC | 233 ms
10,240 KB |
testcase_69 | AC | 239 ms
10,112 KB |
testcase_70 | AC | 249 ms
10,368 KB |
testcase_71 | AC | 237 ms
10,240 KB |
testcase_72 | AC | 233 ms
10,368 KB |
testcase_73 | AC | 233 ms
10,112 KB |
testcase_74 | AC | 1 ms
6,940 KB |
testcase_75 | AC | 243 ms
10,496 KB |
testcase_76 | AC | 251 ms
10,496 KB |
testcase_77 | AC | 243 ms
10,496 KB |
testcase_78 | AC | 251 ms
10,496 KB |
testcase_79 | AC | 245 ms
10,496 KB |
testcase_80 | AC | 256 ms
10,496 KB |
testcase_81 | AC | 248 ms
10,368 KB |
testcase_82 | AC | 243 ms
10,624 KB |
testcase_83 | AC | 238 ms
10,496 KB |
コンパイルメッセージ
warning: type alias `Map` is never used --> src/main.rs:4:6 | 4 | type Map<K, V> = BTreeMap<K, V>; | ^^^ | = note: `#[warn(dead_code)]` on by default warning: type alias `Set` is never used --> src/main.rs:5:6 | 5 | type Set<T> = BTreeSet<T>; | ^^^ warning: type alias `Deque` is never used --> src/main.rs:6:6 | 6 | type Deque<T> = VecDeque<T>; | ^^^^^ warning: function `shuffle` is never used --> src/main.rs:116:4 | 116 | fn shuffle<T>(a: &mut [T]) { | ^^^^^^^
ソースコード
use std::io::Write; use std::collections::*; type Map<K, V> = BTreeMap<K, V>; type Set<T> = BTreeSet<T>; type Deque<T> = VecDeque<T>; fn run() { input! { n: usize, q: usize, k: i64, a: [i64; n], ask: [(usize1, usize); q], } let mut ans = vec!["No"; q]; for _ in 0..30 { let m = (rand() % 1000000000 + 1) as i64; let r = k % m; let mut pow = vec![1; n + 1]; for i in 1..(n + 1) { pow[i] = pow[i - 1] * (k % m) % m; } let mut sum = vec![0; n + 1]; for (i, a) in a.iter().enumerate().rev() { let a = (*a % m + m) % m; sum[i] = (sum[i + 1] * r + a) % m; } for (ans, &(l, r)) in ans.iter_mut().zip(ask.iter()) { let val = (sum[l] - sum[r] * pow[r - l] + m * m) % m; if val != 0 { *ans = "Yes"; } } } let out = std::io::stdout(); let mut out = std::io::BufWriter::new(out.lock()); for a in ans { writeln!(out, "{}", a).ok(); } } fn main() { run(); } // ---------- begin input macro ---------- // reference: https://qiita.com/tanakh/items/0ba42c7ca36cd29d0ac8 #[macro_export] macro_rules! input { (source = $s:expr, $($r:tt)*) => { let mut iter = $s.split_whitespace(); input_inner!{iter, $($r)*} }; ($($r:tt)*) => { let s = { use std::io::Read; let mut s = String::new(); std::io::stdin().read_to_string(&mut s).unwrap(); s }; let mut iter = s.split_whitespace(); input_inner!{iter, $($r)*} }; } #[macro_export] macro_rules! input_inner { ($iter:expr) => {}; ($iter:expr, ) => {}; ($iter:expr, $var:ident : $t:tt $($r:tt)*) => { let $var = read_value!($iter, $t); input_inner!{$iter $($r)*} }; } #[macro_export] macro_rules! read_value { ($iter:expr, ( $($t:tt),* )) => { ( $(read_value!($iter, $t)),* ) }; ($iter:expr, [ $t:tt ; $len:expr ]) => { (0..$len).map(|_| read_value!($iter, $t)).collect::<Vec<_>>() }; ($iter:expr, chars) => { read_value!($iter, String).chars().collect::<Vec<char>>() }; ($iter:expr, bytes) => { read_value!($iter, String).bytes().collect::<Vec<u8>>() }; ($iter:expr, usize1) => { read_value!($iter, usize) - 1 }; ($iter:expr, $t:ty) => { $iter.next().unwrap().parse::<$t>().expect("Parse error") }; } // ---------- end input macro ---------- fn rand_memory() -> usize { Box::into_raw(Box::new("I hope this is a random number")) as usize } fn rand() -> usize { static mut X: usize = 0; unsafe { if X == 0 { X = rand_memory(); } X ^= X << 13; X ^= X >> 17; X ^= X << 5; X } } fn shuffle<T>(a: &mut [T]) { for i in 1..a.len() { let p = rand() % (i + 1); a.swap(i, p); } }