結果
問題 | No.1338 Giant Class |
ユーザー | fukafukatani |
提出日時 | 2021-01-15 22:23:40 |
言語 | Rust (1.72.1) |
結果 |
AC
|
実行時間 | 170 ms / 2,000 ms |
コード長 | 1,290 bytes |
コンパイル時間 | 1,087 ms |
コンパイル使用メモリ | 162,888 KB |
実行使用メモリ | 6,956 KB |
最終ジャッジ日時 | 2023-08-17 17:40:55 |
合計ジャッジ時間 | 4,909 ms |
ジャッジサーバーID (参考情報) |
judge11 / judge12 |
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 1 ms
4,376 KB |
testcase_01 | AC | 1 ms
4,380 KB |
testcase_02 | AC | 153 ms
4,376 KB |
testcase_03 | AC | 1 ms
4,380 KB |
testcase_04 | AC | 2 ms
4,380 KB |
testcase_05 | AC | 2 ms
4,380 KB |
testcase_06 | AC | 104 ms
6,356 KB |
testcase_07 | AC | 146 ms
6,760 KB |
testcase_08 | AC | 98 ms
6,284 KB |
testcase_09 | AC | 91 ms
4,604 KB |
testcase_10 | AC | 167 ms
6,852 KB |
testcase_11 | AC | 17 ms
4,376 KB |
testcase_12 | AC | 118 ms
4,852 KB |
testcase_13 | AC | 93 ms
4,664 KB |
testcase_14 | AC | 26 ms
4,376 KB |
testcase_15 | AC | 39 ms
4,376 KB |
testcase_16 | AC | 14 ms
4,376 KB |
testcase_17 | AC | 96 ms
4,648 KB |
testcase_18 | AC | 26 ms
4,376 KB |
testcase_19 | AC | 45 ms
4,376 KB |
testcase_20 | AC | 167 ms
6,888 KB |
testcase_21 | AC | 170 ms
6,896 KB |
testcase_22 | AC | 165 ms
6,956 KB |
コンパイルメッセージ
warning: unnecessary parentheses around assigned value --> Main.rs:38:20 | 38 | ans -= (h - y); | ^ ^ | = note: `#[warn(unused_parens)]` on by default help: remove these parentheses | 38 - ans -= (h - y); 38 + ans -= h - y; | warning: unused variable: `i` --> Main.rs:23:9 | 23 | for i in 0..q { | ^ help: if this is intentional, prefix it with an underscore: `_i` | = note: `#[warn(unused_variables)]` on by default warning: 2 warnings emitted
ソースコード
#![allow(unused_imports)] use std::cmp::*; use std::collections::*; use std::io::Write; use std::ops::Bound::*; #[allow(unused_macros)] macro_rules! debug { ($($e:expr),*) => { #[cfg(debug_assertions)] $({ let (e, mut err) = (stringify!($e), std::io::stderr()); writeln!(err, "{} = {:?}", e, $e).unwrap() })* }; } fn main() { let v = read_vec::<i64>(); let (h, w, q) = (v[0], v[1], v[2] as usize); let mut queries = vec![]; for i in 0..q { let v = read_vec::<i64>(); let (y, x) = (v[0] - 1, v[1]); queries.push((y, x)); } let mut count = HashMap::new(); let mut ans = h * w; for (y, x) in queries { if let Some(e) = count.get_mut(&x) { if y < *e { ans -= *e - y; *e = y; } } else { count.insert(x, y); ans -= (h - y); } println!("{}", ans); } } fn read<T: std::str::FromStr>() -> T { let mut s = String::new(); std::io::stdin().read_line(&mut s).ok(); s.trim().parse().ok().unwrap() } fn read_vec<T: std::str::FromStr>() -> Vec<T> { read::<String>() .split_whitespace() .map(|e| e.parse().ok().unwrap()) .collect() }