結果

問題 No.11 カードマッチ
ユーザー hanyu
提出日時 2020-12-26 17:25:51
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 3 ms / 5,000 ms
コード長 433 bytes
コンパイル時間 1,935 ms
コンパイル使用メモリ 201,828 KB
最終ジャッジ日時 2025-01-17 07:31:10
ジャッジサーバーID
(参考情報)
judge2 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 19
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;

using ll = long long;

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  
  ll w, h, n;
  cin >> w >> h >> n;
  
  vector<ll> s(n), k(n);
  map<ll, ll> mp1, mp2;
  for (int i = 0; i < n; i++) {
    cin >> s.at(i) >> k.at(i);
    mp1[s.at(i)]++;
    mp2[k.at(i)]++;
  }
  
  ll ans = (mp1.size() * h) + (mp2.size() * w) - (mp1.size() * mp2.size()) - n;
  cout << ans << '\n';
}
0