結果

問題 No.1338 Giant Class
ユーザー ixTL255ixTL255
提出日時 2023-01-02 15:16:17
言語 Rust
(1.77.0)
結果
AC  
実行時間 153 ms / 2,000 ms
コード長 659 bytes
コンパイル時間 2,158 ms
コンパイル使用メモリ 142,972 KB
実行使用メモリ 7,408 KB
最終ジャッジ日時 2023-08-17 23:33:41
合計ジャッジ時間 6,355 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,380 KB
testcase_01 AC 1 ms
4,380 KB
testcase_02 AC 132 ms
4,380 KB
testcase_03 AC 1 ms
4,380 KB
testcase_04 AC 1 ms
4,376 KB
testcase_05 AC 2 ms
4,380 KB
testcase_06 AC 93 ms
6,344 KB
testcase_07 AC 130 ms
7,408 KB
testcase_08 AC 91 ms
6,332 KB
testcase_09 AC 83 ms
4,788 KB
testcase_10 AC 147 ms
7,392 KB
testcase_11 AC 14 ms
4,380 KB
testcase_12 AC 106 ms
4,780 KB
testcase_13 AC 87 ms
5,752 KB
testcase_14 AC 24 ms
4,380 KB
testcase_15 AC 34 ms
4,388 KB
testcase_16 AC 13 ms
4,380 KB
testcase_17 AC 86 ms
5,800 KB
testcase_18 AC 24 ms
4,380 KB
testcase_19 AC 42 ms
4,380 KB
testcase_20 AC 150 ms
7,392 KB
testcase_21 AC 150 ms
7,336 KB
testcase_22 AC 153 ms
7,396 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

use std::io::Read;
use std::collections::HashMap;

fn main() {
	let mut s = String::new();
	std::io::stdin().read_to_string(&mut s).ok();
	let mut itr = s.trim().split_whitespace();
	let h: usize = itr.next().unwrap().parse().unwrap();
	let w: usize = itr.next().unwrap().parse().unwrap();	
	let q: usize = itr.next().unwrap().parse().unwrap();	
	
	let mut ans = h * w;
	let mut m = HashMap::new();
	
	for _ in 0..q {
		let y = itr.next().unwrap().parse::<usize>().unwrap() - 1;
		let x = itr.next().unwrap().parse::<usize>().unwrap() - 1;
		
		let v = m.get(&x).unwrap_or(&h);
		if v > &y {
			ans -= v - y;
			m.insert(x, y);
		}
		println!("{}", ans);
	}
}
0