結果

問題 No.11 カードマッチ
ユーザー satanic
提出日時 2015-12-13 15:30:20
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
MLE  
実行時間 -
コード長 685 bytes
コンパイル時間 640 ms
コンパイル使用メモリ 66,936 KB
実行使用メモリ 817,664 KB
最終ジャッジ日時 2024-09-15 11:42:45
合計ジャッジ時間 2,406 ms
ジャッジサーバーID
(参考情報)
judge3 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 4 MLE * 1 -- * 14
権限があれば一括ダウンロードができます

ソースコード

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