結果
問題 | No.647 明太子 |
ユーザー | sntea |
提出日時 | 2018-02-09 22:31:04 |
言語 | Rust (1.77.0) |
結果 |
AC
|
実行時間 | 44 ms / 4,500 ms |
コード長 | 2,528 bytes |
コンパイル時間 | 1,509 ms |
コンパイル使用メモリ | 155,028 KB |
実行使用メモリ | 4,380 KB |
最終ジャッジ日時 | 2023-09-09 09:21:51 |
合計ジャッジ時間 | 2,684 ms |
ジャッジサーバーID (参考情報) |
judge15 / judge11 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 1 ms
4,376 KB |
testcase_01 | AC | 1 ms
4,380 KB |
testcase_02 | AC | 1 ms
4,380 KB |
testcase_03 | AC | 1 ms
4,376 KB |
testcase_04 | AC | 1 ms
4,380 KB |
testcase_05 | AC | 1 ms
4,376 KB |
testcase_06 | AC | 1 ms
4,376 KB |
testcase_07 | AC | 1 ms
4,376 KB |
testcase_08 | AC | 1 ms
4,380 KB |
testcase_09 | AC | 2 ms
4,376 KB |
testcase_10 | AC | 2 ms
4,376 KB |
testcase_11 | AC | 1 ms
4,376 KB |
testcase_12 | AC | 2 ms
4,376 KB |
testcase_13 | AC | 4 ms
4,376 KB |
testcase_14 | AC | 33 ms
4,380 KB |
testcase_15 | AC | 5 ms
4,376 KB |
testcase_16 | AC | 2 ms
4,376 KB |
testcase_17 | AC | 40 ms
4,380 KB |
testcase_18 | AC | 44 ms
4,380 KB |
testcase_19 | AC | 4 ms
4,376 KB |
testcase_20 | AC | 4 ms
4,380 KB |
testcase_21 | AC | 3 ms
4,376 KB |
testcase_22 | AC | 26 ms
4,380 KB |
testcase_23 | AC | 1 ms
4,376 KB |
コンパイルメッセージ
warning: unused macro definition: `readlvec` --> Main.rs:29:14 | 29 | macro_rules! readlvec { | ^^^^^^^^ | = note: `#[warn(unused_macros)]` on by default warning: unused macro definition: `debug` --> Main.rs:39:14 | 39 | macro_rules! debug { | ^^^^^ warning: function `printiter` is never used --> Main.rs:45:4 | 45 | fn printiter<'a, T>(v: &'a T) | ^^^^^^^^^ | = note: `#[warn(dead_code)]` on by default warning: associated function `print` is never used --> Main.rs:68:8 | 68 | fn print<T>(&mut self, x: T) | ^^^^^ warning: 4 warnings emitted
ソースコード
// use std::ops::{Index, IndexMut}; // use std::cmp::{Ordering, min, max}; // use std::collections::{BinaryHeap, BTreeMap}; // use std::collections::btree_map::Entry::{Occupied, Vacant}; // use std::clone::Clone; fn getline() -> String { let mut res = String::new(); std::io::stdin().read_line(&mut res).ok(); res } macro_rules! readl { ($t: ty) => { { let s = getline(); s.trim().parse::<$t>().unwrap() } }; ($( $t: ty),+ ) => { { let s = getline(); let mut iter = s.trim().split(' '); ($(iter.next().unwrap().parse::<$t>().unwrap(),)*) } }; } macro_rules! readlvec { ($t: ty) => { { let s = getline(); let iter = s.trim().split(' '); iter.map(|x| x.parse().unwrap()).collect::<Vec<$t>>() } } } macro_rules! debug { ($x: expr) => { println!("{}: {:?}", stringify!($x), $x) } } fn printiter<'a, T>(v: &'a T) where &'a T: std::iter::IntoIterator, <&'a T as std::iter::IntoIterator>::Item: std::fmt::Display, { for (i, e) in v.into_iter().enumerate() { if i != 0 { print!(" "); } print!("{}", e); } println!(""); } struct ContestPrinter { s: String, } impl ContestPrinter { fn new() -> ContestPrinter { ContestPrinter { s: String::new() } } fn print<T>(&mut self, x: T) where T: std::fmt::Display, { self.s.push_str(format!("{}", x).as_str()); } fn println<T>(&mut self, x: T) where T: std::fmt::Display, { self.s.push_str(format!("{}\n", x).as_str()); } } impl std::ops::Drop for ContestPrinter { fn drop(&mut self) { print!("{}", self.s); } } fn main() { let mut printer = ContestPrinter::new(); let n = readl!(usize); let mut av = Vec::new(); let mut bv = Vec::new(); for _ in 0..n { let (a, b) = readl!(i64, i64); av.push(a); bv.push(b); } let m = readl!(usize); let mut cnt = vec![0; m]; for k in 0..m { let (x, y) = readl!(i64, i64); for i in 0..n { if av[i] >= x && y >= bv[i] { cnt[k] += 1; } } } let ma = cnt.iter().map(|&x| x).max().unwrap(); if ma == 0 { printer.println(0); } else { for i in 0..m { if cnt[i] == ma { printer.println(i+1); } } } }