結果

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

ソースコード

diff #

#include<bits/stdc++.h>
using namespace std;

typedef long long ll;
typedef pair<int,int> P;

#define p_ary(ary,a,b) do { cout << "["; for (int count = (a);count < (b);++count) cout << ary[count] << ((b)-1 == count ? "" : ", "); cout << "]\n"; } while(0)
#define p_map(map,it) do {cout << "{";for (auto (it) = map.begin();;++(it)) {if ((it) == map.end()) {cout << "}\n";break;}else cout << "" << (it)->first << "=>" << (it)->second << ", ";}}while(0)

int main() {
    int h,w;
    cin >> h >> w;
    vector<string> a(h);
    for (int i = 0;i < h;++i) cin >> a[i];
    bool tate = false,yoko = false;
    for (int i = 0;i < h;++i) {
        bool same = true;
        for (int j = 1;j < w;++j) {
            if (a[i][j-1] != a[i][j]) {
                same = false;
                break;
            }
        }
        if (same) yoko = true;
    }
    for (int i = 0;i < w;++i) {
        bool same = true;
        for (int j = 1;j < h;++j) {
            if (a[j-1][i] != a[j][i]) {
                same = false;
                break;
            }
        }
        if (same) tate = true;
    }
    cout << (tate && yoko ? "NO" : "YES") << endl;
    return 0;
}
0