結果

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

ソースコード

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;
    }
    
    bool ok=true;
    
    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) ok=false;
    }
    
    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) ok=false;
    }
    
    if(ok) cout<<"YES"<<endl;
    else cout<<"NO"<<endl;
}

0