結果
問題 | No.923 オセロきりきざむたん |
ユーザー |
![]() |
提出日時 | 2019-11-08 23:12:44 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 15 ms / 2,000 ms |
コード長 | 802 bytes |
コンパイル時間 | 1,699 ms |
コンパイル使用メモリ | 168,724 KB |
実行使用メモリ | 6,528 KB |
最終ジャッジ日時 | 2024-09-15 02:54:50 |
合計ジャッジ時間 | 3,933 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 84 |
ソースコード
#include <bits/stdc++.h> using namespace std; typedef long long ll; #define all(x) (x).begin(),(x).end() const int mod=1000000007,MAX=100003,INF=1<<30; int main(){ int H,W;cin>>H>>W; vector<string> S(H); for(int i=0;i<H;i++) cin>>S[i]; if(H==1&&W==1){ if(S[0][0]=='1') cout<<"YES"<<endl; else cout<<"NO"<<endl; return 0; } int ok1=0,ok2=0; for(int i=0;i<H;i++){ int cnt=0; for(int j=1;j<W;j++){ if(S[i][j]!=S[i][0]) cnt++; } if(cnt==0) ok1++; } for(int j=0;j<W;j++){ int cnt=0; for(int i=1;i<H;i++){ if(S[i][j]!=S[0][j]) cnt++; } if(cnt==0) ok2++; } if(!ok1||!ok2) cout<<"YES"<<endl; else cout<<"NO"<<endl; }