結果

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

ソースコード

diff #

#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <array>
#include <cstring>
#include <cstdlib>
#include <cmath>
using namespace std;
using ll = long long;

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);

    int h, w;
    cin >> h >> w;

    vector<char> a(h * w + 1);
    for (int i = 0; i < h; i++) {
        cin >> &a[w * i];
    }

    int b = 0;

    int s = 1;
    for (int i = 0; i < h; i++) {
        int t = 0;
        for (int j = 0; j < w; j++) {
            t |= a[w * i + j] - '0' + 1;
        }
        if (t != 3) {
            s = 0;
            break;
        }
    }
    b |= s;

    s = 1;
    for (int j = 0; j < w; j++) {
        int t = 0;
        for (int i = 0; i < h; i++) {
            t |= a[w * i + j] - '0' + 1;
        }
        if (t != 3) {
            s = 0;
            break;
        }
    }
    b |= s;

    cout << (b ? "YES" : "NO") << endl;

    return 0;
}
0