結果
| 問題 | No.11 カードマッチ | 
| コンテスト | |
| ユーザー |  | 
| 提出日時 | 2023-10-04 17:24:59 | 
| 言語 | D (dmd 2.109.1) | 
| 結果 | 
                                AC
                                 
                             | 
| 実行時間 | 2 ms / 5,000 ms | 
| コード長 | 523 bytes | 
| コンパイル時間 | 5,148 ms | 
| コンパイル使用メモリ | 225,136 KB | 
| 実行使用メモリ | 6,944 KB | 
| 最終ジャッジ日時 | 2024-07-26 14:49:31 | 
| 合計ジャッジ時間 | 6,027 ms | 
| ジャッジサーバーID (参考情報) | judge5 / judge3 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| other | AC * 19 | 
ソースコード
module main;
import std;
void main()
{
	// 入力
	auto W = readln.chomp.to!long;
	auto H = readln.chomp.to!long;
	auto N = readln.chomp.to!int;
	auto S = new long[](N), K = new long[](N);
	auto sSet = new RedBlackTree!long(), kSet = new RedBlackTree!long();
	foreach (ref s, ref k; lockstep(S, K)) {
		readln.chomp.formattedRead("%d %d", s, k);
		sSet.insert(s);
		kSet.insert(k);
	}
	// 答えの計算
	long ans = sSet.length * H + kSet.length * W - sSet.length * kSet.length - N;
	// 答えの出力
	writeln(ans);
}
            
            
            
        