結果

問題 No.11 カードマッチ
ユーザー itezpaceitezpace
提出日時 2016-08-12 10:29:44
言語 C++11
(gcc 11.4.0)
結果
AC  
実行時間 14 ms / 5,000 ms
コード長 616 bytes
コンパイル時間 570 ms
コンパイル使用メモリ 69,452 KB
実行使用メモリ 26,452 KB
最終ジャッジ日時 2023-08-07 08:23:13
合計ジャッジ時間 1,667 ms
ジャッジサーバーID
(参考情報)
judge11 / judge13
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,380 KB
testcase_01 AC 1 ms
4,376 KB
testcase_02 AC 2 ms
4,380 KB
testcase_03 AC 1 ms
4,376 KB
testcase_04 AC 11 ms
20,396 KB
testcase_05 AC 2 ms
4,376 KB
testcase_06 AC 14 ms
26,348 KB
testcase_07 AC 2 ms
4,380 KB
testcase_08 AC 7 ms
13,724 KB
testcase_09 AC 14 ms
26,452 KB
testcase_10 AC 10 ms
20,676 KB
testcase_11 AC 9 ms
17,816 KB
testcase_12 AC 10 ms
18,068 KB
testcase_13 AC 7 ms
14,592 KB
testcase_14 AC 8 ms
15,764 KB
testcase_15 AC 2 ms
4,380 KB
testcase_16 AC 1 ms
4,376 KB
testcase_17 AC 1 ms
4,380 KB
testcase_18 AC 1 ms
4,376 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <vector>
#include <set>
using namespace std;

int main(){
  int w,h,n,s,k;
  cin>>w;
  cin>>h;
  cin>>n;
  vector<vector<int>> vv;
  set<int> se;
  vv.resize(w);
  for(int i=0; i<n; ++i){
    cin>>s>>k;
    vv[s-1].push_back(k);
    se.insert(k);
  }
  int x;
  x=0;
  for(int i=0; i<vv.size(); ++i){
    int y;
    if(vv[i].size()>0){
      y=h-vv[i].size();
    } else if(vv[i].size()==0){
      y=0;
    }
    x+=y;
  }
  int z;
  z=0;
  for(int i=0; i<vv.size(); ++i){
    if(vv[i].size()==0){
      z++;
    }
  }
  int z2;
  z2=se.size()*z;
  x+=z2;
  cout<<x<<endl;
  return 0;
}
0