結果

問題 No.11 カードマッチ
ユーザー aaaaaaiu
提出日時 2019-08-02 14:19:44
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 4 ms / 5,000 ms
コード長 397 bytes
コンパイル時間 2,224 ms
コンパイル使用メモリ 196,772 KB
最終ジャッジ日時 2025-01-07 10:32:25
ジャッジサーバーID
(参考情報)
judge2 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 19
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;

int main() {
    ll w, h, n;
    cin>>w>>h>>n;
    set<ll> suits;
    set<ll> nums;
    for (int i=0; i < n; i++) {
        ll s, k;
        cin>>s>>k;
        suits.insert(s);
        nums.insert(k);
    }
    ll ns = suits.size();
    ll nn = nums.size();
    cout << ns*nn + (w-ns)*nn + ns*(h-nn) - n << endl;
    return 0;
}
0