結果

問題 No.11 カードマッチ
ユーザー youjo_yamiotiyoujo_yamioti
提出日時 2018-12-02 10:55:05
言語 C++11
(gcc 11.4.0)
結果
AC  
実行時間 339 ms / 5,000 ms
コード長 725 bytes
コンパイル時間 1,204 ms
コンパイル使用メモリ 146,948 KB
実行使用メモリ 4,500 KB
最終ジャッジ日時 2023-09-10 22:27:25
合計ジャッジ時間 3,980 ms
ジャッジサーバーID
(参考情報)
judge11 / judge13
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,376 KB
testcase_01 AC 2 ms
4,380 KB
testcase_02 AC 1 ms
4,380 KB
testcase_03 AC 1 ms
4,500 KB
testcase_04 AC 112 ms
4,380 KB
testcase_05 AC 2 ms
4,376 KB
testcase_06 AC 339 ms
4,380 KB
testcase_07 AC 79 ms
4,380 KB
testcase_08 AC 167 ms
4,376 KB
testcase_09 AC 339 ms
4,376 KB
testcase_10 AC 143 ms
4,376 KB
testcase_11 AC 151 ms
4,380 KB
testcase_12 AC 165 ms
4,380 KB
testcase_13 AC 144 ms
4,376 KB
testcase_14 AC 108 ms
4,380 KB
testcase_15 AC 3 ms
4,380 KB
testcase_16 AC 10 ms
4,380 KB
testcase_17 AC 11 ms
4,376 KB
testcase_18 AC 11 ms
4,380 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
int counter(vector<int> vec,int n){
    int i = 0;
    int c = 0;
    int l = vec.size();
    for(i=0;i<l;i++){
        if(vec[i] == n) c++;
    }
    return c;
}
int main(){
    int W,H,N;
    int sum = 0;
    cin >> W >> H >> N;
    vector<int> S(N+1,0);
    vector<int> K(N+1,0);
    for(int i=1;i<=N;i++){
        cin >> S[i];
        cin >> K[i];
    }
    for(int i=1;i<=W;i++){
        int c1 = counter(S,i);
        if(c1 != 0) sum += H-c1;
    }
    int c3 = 0;
    for(int i=1;i<=W;i++){
        if(counter(S,i) != 0) c3++;
    }
    for(int i=1;i<=H;i++){
        int c2 = counter(K,i);
        if(c2 != 0) sum += W - c3;
    }
    cout << sum << endl;
    return 0;
}
0