結果

問題 No.11 カードマッチ
ユーザー 久我山菜々久我山菜々
提出日時 2018-10-04 20:54:27
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 765 bytes
コンパイル時間 935 ms
コンパイル使用メモリ 103,484 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-04-20 16:35:15
合計ジャッジ時間 1,715 ms
ジャッジサーバーID
(参考情報)
judge1 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
5,248 KB
testcase_01 AC 1 ms
5,376 KB
testcase_02 AC 2 ms
5,376 KB
testcase_03 WA -
testcase_04 AC 1 ms
5,376 KB
testcase_05 AC 2 ms
5,376 KB
testcase_06 WA -
testcase_07 AC 2 ms
5,376 KB
testcase_08 WA -
testcase_09 AC 2 ms
5,376 KB
testcase_10 AC 1 ms
5,376 KB
testcase_11 AC 2 ms
5,376 KB
testcase_12 AC 2 ms
5,376 KB
testcase_13 AC 2 ms
5,376 KB
testcase_14 AC 2 ms
5,376 KB
testcase_15 WA -
testcase_16 WA -
testcase_17 WA -
testcase_18 WA -
権限があれば一括ダウンロードができます

ソースコード

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