結果

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

ソースコード

diff #

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

static int const INF{100000000};

int main(int, char**) {
  int w, h, n;
  std::cin >> w >> h >> n;
  std::vector<std::pair<int, int>> sks(n);
  for(int i{}; i < n; ++i) {
    int s, k;
    std::cin >> s >> k;
    sks[i] = std::make_pair(s, k);
  }

  auto it = std::unique(begin(sks), end(sks), [](auto x, auto y) { return x.first == y.first; });
  int c1 = std::distance(begin(sks), it);
  it = std::unique(begin(sks), end(sks), [](auto x, auto y) { return x.second == y.second; });
  int c2 = std::distance(begin(sks), it);

  long long ans = w * h - (h - c1) * (w - c2) - n;
  std::cout << ans  << std::endl;

  return 0;
}
0