結果

問題 No.11 カードマッチ
ユーザー J31831276J31831276
提出日時 2018-12-28 00:39:31
言語 C++11
(gcc 11.4.0)
結果
AC  
実行時間 11 ms / 5,000 ms
コード長 543 bytes
コンパイル時間 477 ms
コンパイル使用メモリ 62,032 KB
実行使用メモリ 18,776 KB
最終ジャッジ日時 2024-04-09 03:09:16
合計ジャッジ時間 1,476 ms
ジャッジサーバーID
(参考情報)
judge2 / judge5
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
6,816 KB
testcase_01 AC 2 ms
6,944 KB
testcase_02 AC 1 ms
6,948 KB
testcase_03 AC 2 ms
6,948 KB
testcase_04 AC 6 ms
9,912 KB
testcase_05 AC 2 ms
6,948 KB
testcase_06 AC 10 ms
18,772 KB
testcase_07 AC 4 ms
8,356 KB
testcase_08 AC 7 ms
11,344 KB
testcase_09 AC 11 ms
18,776 KB
testcase_10 AC 10 ms
15,708 KB
testcase_11 AC 9 ms
14,516 KB
testcase_12 AC 9 ms
15,076 KB
testcase_13 AC 8 ms
14,060 KB
testcase_14 AC 6 ms
9,168 KB
testcase_15 AC 2 ms
6,948 KB
testcase_16 AC 2 ms
6,944 KB
testcase_17 AC 3 ms
6,948 KB
testcase_18 AC 2 ms
6,944 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