結果

問題 No.11 カードマッチ
ユーザー msm1993msm1993
提出日時 2019-04-16 13:06:02
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 12 ms / 5,000 ms
コード長 543 bytes
コンパイル時間 1,601 ms
コンパイル使用メモリ 71,584 KB
実行使用メモリ 19,116 KB
最終ジャッジ日時 2023-10-22 07:00:31
合計ジャッジ時間 1,788 ms
ジャッジサーバーID
(参考情報)
judge13 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,348 KB
testcase_01 AC 2 ms
4,348 KB
testcase_02 AC 2 ms
4,348 KB
testcase_03 AC 2 ms
4,348 KB
testcase_04 AC 6 ms
10,080 KB
testcase_05 AC 2 ms
4,348 KB
testcase_06 AC 12 ms
19,116 KB
testcase_07 AC 6 ms
8,564 KB
testcase_08 AC 8 ms
11,400 KB
testcase_09 AC 12 ms
19,116 KB
testcase_10 AC 10 ms
16,016 KB
testcase_11 AC 10 ms
14,764 KB
testcase_12 AC 9 ms
15,224 KB
testcase_13 AC 9 ms
14,236 KB
testcase_14 AC 7 ms
9,356 KB
testcase_15 AC 2 ms
4,348 KB
testcase_16 AC 3 ms
4,348 KB
testcase_17 AC 3 ms
4,348 KB
testcase_18 AC 2 ms
4,348 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <algorithm>
#include <cstdio>
#include <string>
#include <vector>

using namespace std;

#define ll long long

int main(){

   ll w,h,n;
   cin>>w>>h>>n;
   int s[100],k[100];
   vector<ll> W(w+1),H(h+1);
   fill(W.begin(),W.end(),1);
   fill(H.begin(),H.end(),1);
   W[0]=H[0]=0;
   for(int i=0;i<n;++i){
       cin>>s[i]>>k[i];
       W[s[i]]=0;
       H[k[i]]=0;
   }

   ll sw=0,sh=0; //除く和
   for(int i=0;i<=w;++i) sw+=W[i];
   for(int i=0;i<=h;++i) sh+=H[i];
   cout<<w*h-n-sw*sh<<endl;

   return 0;
}
0