結果
| 問題 |
No.923 オセロきりきざむたん
|
| コンテスト | |
| ユーザー |
lumc_
|
| 提出日時 | 2019-09-26 19:21:52 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 8 ms / 2,000 ms |
| コード長 | 1,182 bytes |
| コンパイル時間 | 1,061 ms |
| コンパイル使用メモリ | 105,876 KB |
| 実行使用メモリ | 6,944 KB |
| 最終ジャッジ日時 | 2024-09-15 02:48:07 |
| 合計ジャッジ時間 | 3,204 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 4 |
| other | AC * 84 |
ソースコード
// includes {{{
#include<iostream>
#include<iomanip>
#include<algorithm>
#include<vector>
#include<stack>
#include<queue>
#include<map>
#include<set>
#include<tuple>
#include<cmath>
#include<random>
#include<cassert>
#include<bitset>
#include<cstdlib>
// #include<deque>
// #include<multiset>
// #include<cstring>
// #include<bits/stdc++.h>
// }}}
using namespace std;
using ll = long long;
int HW_MAX = 100'000;
int main() {
std::ios::sync_with_stdio(false), std::cin.tie(0);
int h, w;
cin >> h >> w;
assert(1 <= h and h <= HW_MAX);
assert(1 <= w and w <= HW_MAX);
assert(2 <= h * w and h * w <= HW_MAX);
vector<string> f(h);
for(int i = 0; i < h; i++) {
cin >> f[i];
assert(int(f[i].size()) == w);
for(auto e : f[i]) assert(e == '0' || e == '1');
}
int eca = 0;
for(int i = 0; i < h; i++) {
bool same = 1;
for(int j = 0; j < w; j++) same &= f[i][j] == f[i][0];
if(same) eca |= 0b01;
}
for(int j = 0; j < w; j++) {
bool same = 1;
for(int i = 0; i < h; i++) same &= f[i][j] == f[0][j];
if(same) eca |= 0b10;
}
if(eca == 0b11) {
cout << "NO" << endl;
} else {
cout << "YES" << endl;
}
return 0;
}
lumc_