結果

問題 No.11 カードマッチ
ユーザー naimonon77naimonon77
提出日時 2015-11-19 12:17:38
言語 C++11
(gcc 11.4.0)
結果
AC  
実行時間 5 ms / 5,000 ms
コード長 768 bytes
コンパイル時間 459 ms
コンパイル使用メモリ 57,732 KB
実行使用メモリ 8,104 KB
最終ジャッジ日時 2023-08-02 00:14:50
合計ジャッジ時間 1,430 ms
ジャッジサーバーID
(参考情報)
judge14 / judge12
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
5,552 KB
testcase_01 AC 3 ms
5,584 KB
testcase_02 AC 2 ms
5,788 KB
testcase_03 AC 2 ms
5,528 KB
testcase_04 AC 4 ms
7,880 KB
testcase_05 AC 2 ms
5,596 KB
testcase_06 AC 5 ms
5,792 KB
testcase_07 AC 3 ms
5,808 KB
testcase_08 AC 4 ms
8,104 KB
testcase_09 AC 5 ms
7,844 KB
testcase_10 AC 5 ms
7,740 KB
testcase_11 AC 4 ms
7,888 KB
testcase_12 AC 5 ms
7,796 KB
testcase_13 AC 5 ms
7,804 KB
testcase_14 AC 4 ms
7,900 KB
testcase_15 AC 2 ms
5,600 KB
testcase_16 AC 2 ms
5,988 KB
testcase_17 AC 2 ms
5,772 KB
testcase_18 AC 2 ms
5,728 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#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;
}
0