結果

問題 No.11 カードマッチ
コンテスト
ユーザー rsk0315
提出日時 2019-07-03 18:40:30
言語 C++17
(gcc 15.2.0 + boost 1.89.0)
コンパイル:
g++-15 -O2 -lm -std=c++17 -Wuninitialized -DONLINE_JUDGE -o a.out _filename_
実行:
./a.out
結果
AC  
実行時間 2 ms / 5,000 ms
コード長 470 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 576 ms
コンパイル使用メモリ 74,624 KB
実行使用メモリ 6,400 KB
最終ジャッジ日時 2026-06-07 13:09:25
合計ジャッジ時間 2,508 ms
ジャッジサーバーID
(参考情報)
judge1_1 / judge2_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 19
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

#include <cstdio>
#include <cstdint>
#include <vector>
#include <set>
#include <algorithm>

int main() {
  intmax_t W, H, N;
  scanf("%jd %jd %jd", &W, &H, &N);

  std::set<intmax_t> w, h;
  for (int i = 0; i < N; ++i) {
    int wi, hi;
    scanf("%d %d", &wi, &hi);
    w.insert(wi);
    h.insert(hi);
  }

  intmax_t w0 = w.size();
  intmax_t h0 = h.size();

  intmax_t res = 0;
  res += h0 * W;
  res += H * w0;
  res -= h0 * w0;
  res -= N;
  printf("%jd\n", res);
}
0