結果

問題 No.923 オセロきりきざむたん
ユーザー 沙耶花
提出日時 2024-12-06 23:35:31
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 44 ms / 2,000 ms
コード長 636 bytes
コンパイル時間 4,004 ms
コンパイル使用メモリ 256,224 KB
最終ジャッジ日時 2025-02-26 11:17:16
ジャッジサーバーID
(参考情報)
judge5 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 84
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <stdio.h>
#include <atcoder/all>
#include <bits/stdc++.h>
using namespace std;
using namespace atcoder;
using mint = modint998244353;
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define Inf32 1000000001
#define Inf64 1000000000000000000LL

int main(){
	
	int h,w;
	cin>>h>>w;
	vector<string> s(h);
	rep(i,h)cin>>s[i];
	bool f = true;
	rep(i,h){
		set<char> S;
		rep(j,w)S.insert(s[i][j]);
		if(S.size()==1)f = false;
	}
	if(f)cout<<"YES"<<endl;
	else{
		f =true;
		rep(i,w){
			set<char> S;
			rep(j,h)S.insert(s[j][i]);
			if(S.size()==1)f = false;
		}
		if(f)cout<<"YES"<<endl;
	else cout<<"NO"<<endl;
	}
	
	
	return 0;
}
0