結果
| 問題 | No.11 カードマッチ | 
| コンテスト | |
| ユーザー |  rsk0315 | 
| 提出日時 | 2019-07-03 18:40:30 | 
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) | 
| 結果 | 
                                AC
                                 
                             | 
| 実行時間 | 3 ms / 5,000 ms | 
| コード長 | 470 bytes | 
| コンパイル時間 | 534 ms | 
| コンパイル使用メモリ | 60,212 KB | 
| 最終ジャッジ日時 | 2025-01-07 05:52:13 | 
| ジャッジサーバーID (参考情報) | judge5 / judge1 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| other | AC * 19 | 
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:9:8: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
    9 |   scanf("%jd %jd %jd", &W, &H, &N);
      |   ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~
main.cpp:14:10: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   14 |     scanf("%d %d", &wi, &hi);
      |     ~~~~~^~~~~~~~~~~~~~~~~~~
            
            ソースコード
#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);
}
            
            
            
        