結果

問題 No.11 カードマッチ
ユーザー satanicsatanic
提出日時 2015-12-13 15:30:20
言語 C++11
(gcc 11.4.0)
結果
MLE  
実行時間 -
コード長 685 bytes
コンパイル時間 636 ms
コンパイル使用メモリ 68,116 KB
実行使用メモリ 814,400 KB
最終ジャッジ日時 2023-10-13 14:56:47
合計ジャッジ時間 2,486 ms
ジャッジサーバーID
(参考情報)
judge15 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,352 KB
testcase_01 AC 2 ms
4,348 KB
testcase_02 AC 1 ms
4,352 KB
testcase_03 AC 1 ms
4,348 KB
testcase_04 MLE -
testcase_05 -- -
testcase_06 -- -
testcase_07 -- -
testcase_08 -- -
testcase_09 -- -
testcase_10 -- -
testcase_11 -- -
testcase_12 -- -
testcase_13 -- -
testcase_14 -- -
testcase_15 -- -
testcase_16 -- -
testcase_17 -- -
testcase_18 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

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

int main(){
  int w, h, n, match=0;
  cin >> w >> h >> n;
  vector< vector<int> > hand(n, vector<int>(2));
  vector< vector<bool> > talon(w, vector<bool>(h, true));

  for(int i=0; i<n; ++i){
    for(int j=0; j<2; ++j){
      cin >> hand[i][j];
      --hand[i][j];
    }
    talon[hand[i][0]][hand[i][1]]=false;
  }
  for(int i=0; i<n; ++i){
    for(int j=0; j<h; ++j){
      if(talon[hand[i][0]][j]==true){
	++match;
	talon[hand[i][0]][j]=false;
      }
    }
    for(int j=0; j<w; ++j){
      if(talon[j][hand[i][1]]==true){
	++match;
	talon[j][hand[i][1]]=false;
      }
    }
  }
  cout << match << "\n";
  
  return 0;
}
0