結果

問題 No.483 マッチ並べ
ユーザー Yut176
提出日時 2017-02-10 23:24:46
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 812 bytes
コンパイル時間 970 ms
コンパイル使用メモリ 87,368 KB
実行使用メモリ 6,824 KB
最終ジャッジ日時 2024-12-29 11:14:16
合計ジャッジ時間 2,442 ms
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 27 WA * 26
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<iostream>
#include<algorithm>
#include<cstdio>
#include<cstdlib>
#include<vector>
#include<map>
#include<queue>
#include<string>
#include<sstream>
#include<cmath>
#include<numeric>
using namespace std;


int main(){

  int n;
  cin >> n;
  vector< vector<int> > m(120, vector<int>(120, 0));
  for(int i=0; i<n; i++){
    int r0, c0, r1, c1;
    cin >> r0 >> c0 >> r1 >> c1;

    m[r0][c0]++;
    m[r1][c1]++;
    // if( m[r0][c0] >= 3 || m[] )
  }
  int dx[4] = {0, 1, 0, -1};
  int dy[4] = {-1, 0, 1, 0};

  for(int i=1; i<115; i++){
    for(int j=1; j<115; j++){

      if( m[i][j] >= 3 ){
        for(int k=0; k<4; k++){
          if( m[i+dx[k]][j+dy[k]] >= 3 ){
            cout << "NO" << endl;
            return 0;
          }
        }
      }

    }
  }
  cout << "YES" << endl;

  return 0;
}
0