結果

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

ソースコード

diff #

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

int main(){
    int H, W;
    cin >> H >> W;
    vector<string> S(H);
    for(int i=0; i<H; i++) cin >> S[i];
    bool ok1 = true, ok2 = true;
    for(int i=0; i<H; i++){
        bitset<2> found;
        for(int j=0; j<W; j++) found[S[i][j]-'0'] = 1;
        ok1 &= found.all();
    }
    for(int j=0; j<W; j++){
        bitset<2> found;
        for(int i=0; i<H; i++) found[S[i][j]-'0'] = 1;
        ok2 &= found.all();
    }
    bool ok = (ok1 || ok2);
    cout << (ok ? "YES" : "NO") << endl;
    return 0;
}
0