結果
問題 | No.5012 Better Mo's Algorithm is Needed!! (Execute) |
ユーザー | akakimidori |
提出日時 | 2022-12-17 00:04:52 |
言語 | Rust (1.77.0 + proconio) |
結果 |
AC
|
実行時間 | 60 ms / 500 ms |
コード長 | 2,617 bytes |
コンパイル時間 | 1,046 ms |
実行使用メモリ | 10,004 KB |
スコア | 1,000,000,000,099,731,985 |
最終ジャッジ日時 | 2022-12-17 00:06:23 |
合計ジャッジ時間 | 84,301 ms |
ジャッジサーバーID (参考情報) |
judge13 / judge15 |
純コード判定しない問題か言語 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 1 ms
2,436 KB |
testcase_01 | AC | 38 ms
7,896 KB |
testcase_02 | AC | 58 ms
9,828 KB |
testcase_03 | AC | 60 ms
9,900 KB |
testcase_04 | AC | 59 ms
9,904 KB |
testcase_05 | AC | 57 ms
9,936 KB |
testcase_06 | AC | 59 ms
9,828 KB |
testcase_07 | AC | 57 ms
9,864 KB |
testcase_08 | AC | 60 ms
10,000 KB |
testcase_09 | AC | 59 ms
9,924 KB |
testcase_10 | AC | 58 ms
9,812 KB |
testcase_11 | AC | 57 ms
9,824 KB |
testcase_12 | AC | 59 ms
9,908 KB |
testcase_13 | AC | 60 ms
9,892 KB |
testcase_14 | AC | 58 ms
9,796 KB |
testcase_15 | AC | 58 ms
9,896 KB |
testcase_16 | AC | 58 ms
9,916 KB |
testcase_17 | AC | 59 ms
9,940 KB |
testcase_18 | AC | 58 ms
9,940 KB |
testcase_19 | AC | 58 ms
9,888 KB |
testcase_20 | AC | 58 ms
9,892 KB |
testcase_21 | AC | 59 ms
9,856 KB |
testcase_22 | AC | 5 ms
3,116 KB |
testcase_23 | AC | 6 ms
3,116 KB |
testcase_24 | AC | 5 ms
3,116 KB |
testcase_25 | AC | 10 ms
3,432 KB |
testcase_26 | AC | 10 ms
3,324 KB |
testcase_27 | AC | 10 ms
3,500 KB |
testcase_28 | AC | 24 ms
4,820 KB |
testcase_29 | AC | 25 ms
4,896 KB |
testcase_30 | AC | 24 ms
4,808 KB |
testcase_31 | AC | 52 ms
7,536 KB |
testcase_32 | AC | 51 ms
7,428 KB |
testcase_33 | AC | 52 ms
7,460 KB |
testcase_34 | AC | 6 ms
3,148 KB |
testcase_35 | AC | 6 ms
3,116 KB |
testcase_36 | AC | 6 ms
3,148 KB |
testcase_37 | AC | 11 ms
3,440 KB |
testcase_38 | AC | 11 ms
3,372 KB |
testcase_39 | AC | 11 ms
3,400 KB |
testcase_40 | AC | 26 ms
4,892 KB |
testcase_41 | AC | 25 ms
4,920 KB |
testcase_42 | AC | 25 ms
4,964 KB |
testcase_43 | AC | 56 ms
7,748 KB |
testcase_44 | AC | 56 ms
7,784 KB |
testcase_45 | AC | 54 ms
7,740 KB |
testcase_46 | AC | 8 ms
3,952 KB |
testcase_47 | AC | 8 ms
3,840 KB |
testcase_48 | AC | 8 ms
3,800 KB |
testcase_49 | AC | 13 ms
4,172 KB |
testcase_50 | AC | 12 ms
4,096 KB |
testcase_51 | AC | 12 ms
4,068 KB |
testcase_52 | AC | 27 ms
6,100 KB |
testcase_53 | AC | 27 ms
5,960 KB |
testcase_54 | AC | 27 ms
6,032 KB |
testcase_55 | AC | 57 ms
7,640 KB |
testcase_56 | AC | 56 ms
7,640 KB |
testcase_57 | AC | 55 ms
7,648 KB |
testcase_58 | AC | 11 ms
5,064 KB |
testcase_59 | AC | 11 ms
4,984 KB |
testcase_60 | AC | 11 ms
5,024 KB |
testcase_61 | AC | 15 ms
5,252 KB |
testcase_62 | AC | 15 ms
5,300 KB |
testcase_63 | AC | 15 ms
5,248 KB |
testcase_64 | AC | 29 ms
6,228 KB |
testcase_65 | AC | 29 ms
6,160 KB |
testcase_66 | AC | 30 ms
6,264 KB |
testcase_67 | AC | 58 ms
9,864 KB |
testcase_68 | AC | 59 ms
9,824 KB |
testcase_69 | AC | 59 ms
9,800 KB |
testcase_70 | AC | 60 ms
9,892 KB |
testcase_71 | AC | 58 ms
9,900 KB |
testcase_72 | AC | 58 ms
9,904 KB |
testcase_73 | AC | 58 ms
9,860 KB |
testcase_74 | AC | 58 ms
9,812 KB |
testcase_75 | AC | 58 ms
9,900 KB |
testcase_76 | AC | 57 ms
9,888 KB |
testcase_77 | AC | 58 ms
9,928 KB |
testcase_78 | AC | 59 ms
9,828 KB |
testcase_79 | AC | 57 ms
9,812 KB |
testcase_80 | AC | 57 ms
9,936 KB |
testcase_81 | AC | 58 ms
9,924 KB |
testcase_82 | AC | 59 ms
9,776 KB |
testcase_83 | AC | 58 ms
9,884 KB |
testcase_84 | AC | 59 ms
10,004 KB |
testcase_85 | AC | 59 ms
9,892 KB |
testcase_86 | AC | 58 ms
9,884 KB |
testcase_87 | AC | 57 ms
9,752 KB |
testcase_88 | AC | 58 ms
9,892 KB |
testcase_89 | AC | 58 ms
9,748 KB |
testcase_90 | AC | 60 ms
9,872 KB |
testcase_91 | AC | 58 ms
9,856 KB |
testcase_92 | AC | 58 ms
9,748 KB |
testcase_93 | AC | 59 ms
9,904 KB |
testcase_94 | AC | 57 ms
9,912 KB |
testcase_95 | AC | 57 ms
9,932 KB |
testcase_96 | AC | 59 ms
9,880 KB |
testcase_97 | AC | 58 ms
9,788 KB |
testcase_98 | AC | 59 ms
10,004 KB |
testcase_99 | AC | 57 ms
9,888 KB |
コンパイルメッセージ
warning: unused import: `std::io::Write` --> Main.rs:1:5 | 1 | use std::io::Write; | ^^^^^^^^^^^^^^ | = note: `#[warn(unused_imports)]` on by default warning: type alias is never used: `Map` --> Main.rs:4:1 | 4 | type Map<K, V> = BTreeMap<K, V>; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = note: `#[warn(dead_code)]` on by default warning: type alias is never used: `Set` --> Main.rs:5:1 | 5 | type Set<T> = BTreeSet<T>; | ^^^^^^^^^^^^^^^^^^^^^^^^^^ warning: type alias is never used: `Deque` --> Main.rs:6:1 | 6 | type Deque<T> = VecDeque<T>; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ warning: 4 warnings emitted
ソースコード
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, _a: [u32; n], ask: [(usize1, usize); q], } let batch = ((n as f64) / (q as f64).sqrt()).ceil() as usize; let mut p = (0..q).collect::<Vec<_>>(); p.sort_by_key(|x| { let (l, r) = ask[*x]; let l = l / batch; let r = if l % 2 == 0 {r} else {!r}; (l, r) }); use util::*; println!("{}", p.iter().map(|p| *p + 1).join(" ")); } 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 ---------- mod util { pub trait Join { fn join(self, sep: &str) -> String; } impl<T, I> Join for I where I: Iterator<Item = T>, T: std::fmt::Display, { fn join(self, sep: &str) -> String { let mut s = String::new(); use std::fmt::*; for (i, v) in self.enumerate() { if i > 0 { write!(&mut s, "{}", sep).ok(); } write!(&mut s, "{}", v).ok(); } s } } }