結果

問題 No.11 カードマッチ
ユーザー 久我山菜々久我山菜々
提出日時 2018-10-04 21:07:59
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 18 ms / 5,000 ms
コード長 566 bytes
コンパイル時間 716 ms
コンパイル使用メモリ 102,164 KB
最終ジャッジ日時 2025-01-06 14:16:13
ジャッジサーバーID
(参考情報)
judge5 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 19
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<iostream>
#include<vector>
#include<map>
#include<algorithm>
#include<cmath>
#include<queue>
#include<numeric>
#include<bitset>
#include<set>

static int const INF{100000000};

int main(int, char**) {
  long long w, h, n;
  std::cin >> w >> h >> n;
  std::set<int> ss;
  std::set<int> ks;
  for(int i{}; i < n; ++i) {
    int s, k;
    std::cin >> s >> k;
    ss.insert(s);
    ks.insert(k);
  }

  long long ans{};
  ans += ss.size() * h;
  ans += ks.size() * w;
  ans -= ss.size() * ks.size();
  ans -= n;
  std::cout << ans  << std::endl;

  return 0;
}
0