結果

問題 No.11 カードマッチ
ユーザー GOTKAKO
提出日時 2024-08-04 14:45:17
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 2 ms / 5,000 ms
コード長 427 bytes
コンパイル時間 1,882 ms
コンパイル使用メモリ 195,624 KB
最終ジャッジ日時 2025-02-23 20:58:54
ジャッジサーバーID
(参考情報)
judge2 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 19
権限があれば一括ダウンロードができます

ソースコード

diff #

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

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);

    int W,H; cin >> W >> H;
    vector<bool> S(W),K(H);
    int N; cin >> N;
    int m = 0,n = 0,answer = -N;
    while(N--){
        int s,k; cin >> s >> k;
        s--; k--;
        if(!S.at(s)) S.at(s) = true,m++;
        if(!K.at(k)) K.at(k) = true,n++; 
    }
    cout << answer+m*H+W*n-m*n << endl;
}
0