結果
| 問題 | No.11 カードマッチ | 
| コンテスト | |
| ユーザー |  opqopq_ | 
| 提出日時 | 2015-05-11 22:02:53 | 
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) | 
| 結果 | 
                                AC
                                 
                             | 
| 実行時間 | 2 ms / 5,000 ms | 
| コード長 | 463 bytes | 
| コンパイル時間 | 397 ms | 
| コンパイル使用メモリ | 45,056 KB | 
| 実行使用メモリ | 5,248 KB | 
| 最終ジャッジ日時 | 2024-10-11 19:47:55 | 
| 合計ジャッジ時間 | 1,081 ms | 
| ジャッジサーバーID (参考情報) | judge2 / judge4 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| other | AC * 19 | 
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:11:14: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   11 |         scanf("%d%d%d", &W, &H, &N);
      |         ~~~~~^~~~~~~~~~~~~~~~~~~~~~
main.cpp:13:22: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   13 |                 scanf("%d%d", S + i, K + i);
      |                 ~~~~~^~~~~~~~~~~~~~~~~~~~~~
            
            ソースコード
#include <cstdio>
#include <map>
using namespace std;
#define N_MAX 100
int W, H, N;
int S[N_MAX], K[N_MAX];
int main() {
	scanf("%d%d%d", &W, &H, &N);
	for (int i = 0; i < N; i++) {
		scanf("%d%d", S + i, K + i);
	}
	
	map<int, int> s, k;
	for (int i = 0; i < N; i++) {
		s[S[i]]++, k[K[i]]++;
	}
	
	long long res = 0;
	for (auto& p : s) {
		res += H;
		W--;
	}
	for (auto& p : k) {
		res += W;
		res -= p.second;
	}
	
	printf("%lld\n", res);
	
	return 0;
}
            
            
            
        