結果

問題 No.11 カードマッチ
コンテスト
ユーザー satanic
提出日時 2015-12-13 15:30:20
言語 C++11
(gcc 15.2.0 + boost 1.89.0)
コンパイル:
g++-15 -O2 -lm -std=gnu++11 -Wuninitialized -DONLINE_JUDGE -o a.out _filename_
実行:
./a.out
結果
MLE  
実行時間 -
コード長 685 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 842 ms
コンパイル使用メモリ 84,220 KB
実行使用メモリ 1,308,032 KB
最終ジャッジ日時 2026-04-04 19:32:11
合計ジャッジ時間 2,438 ms
ジャッジサーバーID
(参考情報)
judge5_1 / judge3_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 4 MLE * 2 -- * 13
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

#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