結果

問題 No.11 カードマッチ
ユーザー nenuonnenuon
提出日時 2017-07-20 17:56:16
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 6 ms / 5,000 ms
コード長 799 bytes
コンパイル時間 922 ms
コンパイル使用メモリ 81,808 KB
実行使用メモリ 8,524 KB
最終ジャッジ日時 2023-07-30 03:52:04
合計ジャッジ時間 2,178 ms
ジャッジサーバーID
(参考情報)
judge13 / judge15
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 4 ms
8,212 KB
testcase_01 AC 4 ms
8,212 KB
testcase_02 AC 4 ms
8,204 KB
testcase_03 AC 5 ms
8,200 KB
testcase_04 AC 5 ms
8,304 KB
testcase_05 AC 5 ms
8,212 KB
testcase_06 AC 5 ms
8,244 KB
testcase_07 AC 4 ms
8,524 KB
testcase_08 AC 5 ms
8,304 KB
testcase_09 AC 6 ms
8,216 KB
testcase_10 AC 5 ms
8,228 KB
testcase_11 AC 4 ms
8,228 KB
testcase_12 AC 5 ms
8,264 KB
testcase_13 AC 5 ms
8,508 KB
testcase_14 AC 5 ms
8,212 KB
testcase_15 AC 4 ms
8,208 KB
testcase_16 AC 4 ms
8,244 KB
testcase_17 AC 4 ms
8,244 KB
testcase_18 AC 4 ms
8,224 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <algorithm>
#include <cstdio>
#include <iostream>
#include <map>
#include <cmath>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <vector>
#include <stdlib.h>
#include <stdio.h>
#include <bitset>
using namespace std;
#define FOR(I,A,B) for(int I = (A); I < (B); ++I)
typedef long long ll;
int t[1000006]; // マークが何回出たか
bool is[1000006];
int main()
{
  FOR(i,0,1000006) {
    t[i] = 0;
    is[i] = false;
  }
  int W,H,N;
  cin >> W >> H >> N;
  int cnt = 0; // 出た数
  FOR(i,0,N) {
    int s, k;
    cin >> s >> k;
    t[s]++;
    if(!is[k]) cnt++;
    is[k] = true;
  }
  ll ans = 0;
  FOR(i,1,W+1) {
    if(t[i] == 0) {
      ans += cnt;
    } else {
      ans += H - t[i];
    }
  }
  cout << ans << endl;
  return 0;
}
0