結果
| 問題 | No.11 カードマッチ | 
| コンテスト | |
| ユーザー |  | 
| 提出日時 | 2015-11-19 12:17:38 | 
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) | 
| 結果 | 
                                AC
                                 
                             | 
| 実行時間 | 5 ms / 5,000 ms | 
| コード長 | 768 bytes | 
| コンパイル時間 | 416 ms | 
| コンパイル使用メモリ | 56,248 KB | 
| 実行使用メモリ | 5,248 KB | 
| 最終ジャッジ日時 | 2024-10-11 19:57:27 | 
| 合計ジャッジ時間 | 1,093 ms | 
| ジャッジサーバーID (参考情報) | judge5 / judge1 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| other | AC * 19 | 
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:24:8: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   24 |   scanf("%d",&w);
      |   ~~~~~^~~~~~~~~
main.cpp:25:8: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   25 |   scanf("%d",&h);
      |   ~~~~~^~~~~~~~~
main.cpp:26:8: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   26 |   scanf("%d",&n);
      |   ~~~~~^~~~~~~~~
main.cpp:28:14: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   28 |         scanf("%d",&s);
      |         ~~~~~^~~~~~~~~
main.cpp:30:14: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   30 |         scanf("%d",&k);
      |         ~~~~~^~~~~~~~~
            
            ソースコード
#include <cstring>
#include <algorithm>
#include <cstdio>
#include <iostream>
#define REP(i,a,b) for(i=a;i<b;i++)
#define rep(i,n) REP(i,0,n)
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
/* ここからが本編 */
/* */
/* 入力開始! */
/* 入力終了! */
int main(void)
{
  int i;
  int w,h,n,s,k;
  static int value[1000000];
  static int type[1000000];
  int value_sum = 0,type_sum = 0;
  scanf("%d",&w);
  scanf("%d",&h);
  scanf("%d",&n);
  rep(i,n) {
	scanf("%d",&s);
	value[s-1] = 1;
	scanf("%d",&k);
	type[k-1] = 1;
  }
  rep(i,w) {
	if(value[i]) value_sum++;
  }
  rep(i,h) {
	if(type[i]) type_sum++;
  }
  printf("%llu\n",(ull)w*h
		 - (w-(ull)value_sum)*(h-(ull)type_sum) - n);
  return 0;
}
            
            
            
        