結果
問題 |
No.923 オセロきりきざむたん
|
ユーザー |
![]() |
提出日時 | 2019-11-13 16:27:38 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 1,527 bytes |
コンパイル時間 | 1,007 ms |
コンパイル使用メモリ | 101,832 KB |
実行使用メモリ | 10,632 KB |
最終ジャッジ日時 | 2024-09-21 21:09:22 |
合計ジャッジ時間 | 3,598 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 78 WA * 6 |
ソースコード
#include <iostream> #include <vector> #include <algorithm> #include <iomanip> #include <string> #include <stack> #include <queue> #include <map> #include <set> #include <cstdio> #include <cstdlib> #include <cmath> #include <climits> #include <cassert> #include <cstdint> #include <numeric> #include <bitset> #include <functional> using namespace std; using ll = long long; using Pll = pair<ll, ll>; using Pii = pair<int, int>; constexpr ll MOD = 1000000007; constexpr long double EPS = 1e-10; constexpr int dyx[4][2] = { { 0, 1}, {-1, 0}, {0,-1}, {1, 0} }; int main() { ios::sync_with_stdio(false); cin.tie(nullptr); int h, w; cin >> h >> w; vector<vector<bool>> has_in_row(h, vector<bool>(2, false)), has_in_column(w, vector<bool>(2, false)); string s; for(int i=0;i<h;++i){ cin >> s; for(int j=0;j<w;++j) { has_in_row[i][s[j]-'0'] = true; has_in_column[j][s[j]-'0'] = true; } } bool is_ok_row = true, is_ok_column = true; if(w != 1) { for(int i=0;i<h;++i){ if(!has_in_row[i][0] || !has_in_row[i][1]) { is_ok_row = false; break; } } } if(h != 1) { for(int i=0;i<w;++i){ if(!has_in_column[i][0] || !has_in_column[i][1]) { is_ok_column = false; break; } } } if(is_ok_column || is_ok_row) { cout << "YES" << endl; } else { cout << "NO" << endl; } }