結果

問題 No.1338 Giant Class
ユーザー ixTL255ixTL255
提出日時 2023-01-02 15:16:17
言語 Rust
(1.77.0)
結果
AC  
実行時間 137 ms / 2,000 ms
コード長 659 bytes
コンパイル時間 11,608 ms
コンパイル使用メモリ 384,020 KB
実行使用メモリ 7,244 KB
最終ジャッジ日時 2024-05-05 06:20:28
合計ジャッジ時間 15,060 ms
ジャッジサーバーID
(参考情報)
judge4 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 0 ms
6,812 KB
testcase_01 AC 1 ms
6,944 KB
testcase_02 AC 130 ms
6,940 KB
testcase_03 AC 1 ms
6,944 KB
testcase_04 AC 1 ms
6,940 KB
testcase_05 AC 1 ms
6,940 KB
testcase_06 AC 92 ms
6,940 KB
testcase_07 AC 125 ms
6,944 KB
testcase_08 AC 84 ms
6,944 KB
testcase_09 AC 73 ms
6,944 KB
testcase_10 AC 131 ms
6,944 KB
testcase_11 AC 14 ms
6,940 KB
testcase_12 AC 97 ms
6,940 KB
testcase_13 AC 84 ms
6,944 KB
testcase_14 AC 22 ms
6,940 KB
testcase_15 AC 32 ms
6,944 KB
testcase_16 AC 12 ms
6,940 KB
testcase_17 AC 81 ms
6,940 KB
testcase_18 AC 22 ms
6,944 KB
testcase_19 AC 39 ms
6,944 KB
testcase_20 AC 136 ms
7,240 KB
testcase_21 AC 134 ms
7,244 KB
testcase_22 AC 137 ms
7,240 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