結果

問題 No.923 オセロきりきざむたん
ユーザー KKT89
提出日時 2019-11-18 05:10:02
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 4 ms / 2,000 ms
コード長 758 bytes
コンパイル時間 674 ms
コンパイル使用メモリ 81,912 KB
実行使用メモリ 6,944 KB
最終ジャッジ日時 2024-09-25 06:12:09
合計ジャッジ時間 3,469 ms
ジャッジサーバーID
(参考情報)
judge1 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 84
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <vector>
#include <algorithm>
#include <map>
#include <queue>
#include <set>
#include <math.h>
using namespace std;
typedef long long int ll;

int a[100100][2];
int b[100100][2];
char c;

int main(){
	cin.tie(nullptr);
	ios::sync_with_stdio(false);
	int h,w; cin >> h >> w;
	for(int i=0;i<h;i++){
		for(int j=0;j<w;j++){
			cin >> c;
			if(c=='0'){
				a[i][0]=1;
				b[j][0]=1;
			}
			else{
				a[i][1]=1;
				b[j][1]=1;
			}
		}
	}
	bool ok=true;
	for(int i=0;i<h;i++){
		if(a[i][0]&&a[i][1]){
			continue;
		}
		else{
			ok=false;
		}
	}
	bool ok1=true;
	for(int i=0;i<w;i++){
		if(b[i][0]&&b[i][1]){
			continue;
		}
		else{
			ok1=false;
		}
	}
	if(ok||ok1){
		cout << "YES" << endl;
	}
	else{
		cout << "NO" << endl;
	}
} 
0