結果

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

ソースコード

diff #

#include <cstdio>
#include <cstring>
#include <iostream>
#include <string>
#include <cmath>
#include <bitset>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <algorithm>
#include <complex>
#include <unordered_map>
#include <unordered_set>
#include <random>
#include <cassert>
#include <fstream>
#include <utility>
#include <functional>
#include <time.h>
#include <stack>
#include <array>
#define popcount __builtin_popcount
using namespace std;
typedef long long int ll;
typedef pair<ll, ll> P;

int main()
{
    int h, w;
    cin>>h>>w;
    string a[100010];
    for(int i=0; i<h; i++){
        cin>>a[i];
    }
    bool dameh=0;
    for(int i=0; i<h; i++){
        bool dame=1;
        for(int j=0; j<w-1; j++){
            if(a[i][j]!=a[i][j+1]){
                dame=0;
                break;
            }
        }
        if(dame){
            dameh=1;
            break;
        }
    }
    bool damew=0;
    for(int j=0; j<w; j++){
        bool dame=1;
        for(int i=0; i<h-1; i++){
            if(a[i][j]!=a[i+1][j]){
                dame=0; break;
            }
        }
        if(dame){
            damew=1;
            break;
        }
    }
    if(!dameh || !damew) cout<<"YES"<<endl;
    else cout<<"NO"<<endl;
	return 0;
}
0