結果

問題 No.923 オセロきりきざむたん
ユーザー Rubikun
提出日時 2019-11-08 23:11:04
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 791 bytes
コンパイル時間 1,613 ms
コンパイル使用メモリ 168,724 KB
実行使用メモリ 6,400 KB
最終ジャッジ日時 2024-09-15 02:54:41
合計ジャッジ時間 3,828 ms
ジャッジサーバーID
(参考情報)
judge4 / judge6
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2 WA * 2
other AC * 43 WA * 41
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define all(x) (x).begin(),(x).end()
const int mod=1000000007,MAX=100003,INF=1<<30;

int main(){

    int H,W;cin>>H>>W;
    vector<string> S(H);
    for(int i=0;i<H;i++) cin>>S[i];
    
    if(H==1&&W==1){
        if(S[0][0]=='1') cout<<"YES"<<endl;
        else cout<<"NO"<<endl;
        return 0;
    }
    
    int ok1=0,ok2=0;
    
    for(int i=0;i<H;i++){
        int cnt=0;
        for(int j=1;j<W;j++){
            if(S[i][j]!=S[i][0]) cnt++;
        }
        if(cnt) ok1++;
    }
    
    for(int j=0;j<W;j++){
        int cnt=0;
        for(int i=0;i<H;i++){
            if(S[i][j]!=S[0][j]) cnt++;
        }
        if(cnt) ok2++;
    }
    
    if(!ok1||!ok2) cout<<"YES"<<endl;
    else cout<<"NO"<<endl;
}

0