結果
| 問題 |
No.923 オセロきりきざむたん
|
| ユーザー |
|
| 提出日時 | 2019-11-09 14:52:40 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 11 ms / 2,000 ms |
| コード長 | 1,179 bytes |
| コンパイル時間 | 1,390 ms |
| コンパイル使用メモリ | 119,124 KB |
| 実行使用メモリ | 5,376 KB |
| 最終ジャッジ日時 | 2024-09-15 04:27:22 |
| 合計ジャッジ時間 | 3,654 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 4 |
| other | AC * 84 |
ソースコード
#define _USE_MATH_DEFINES
#include <cstdio>
#include <iostream>
#include <sstream>
#include <fstream>
#include <iomanip>
#include <algorithm>
#include <cmath>
#include <complex>
#include <string>
#include <vector>
#include <array>
#include <list>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <bitset>
#include <numeric>
#include <limits>
#include <climits>
#include <cfloat>
#include <functional>
#include <iterator>
#include <memory>
#include <regex>
using namespace std;
int main()
{
int h, w;
cin >> h >> w;
vector<int> yCnt(h), xCnt(w);
for(int y=0; y<h; ++y){
for(int x=0; x<w; ++x){
char c;
cin >> c;
if(c == '1'){
++ yCnt[y];
++ xCnt[x];
}
}
}
bool ans = false;
if(h == 1 && w == 1){
ans = (yCnt[0] == 1);
}
else{
sort(yCnt.begin(), yCnt.end());
sort(xCnt.begin(), xCnt.end());
ans = !((yCnt.front() == 0 || yCnt.back() == w) && (xCnt.front() == 0 || xCnt.back() == h));
}
if(ans)
cout << "YES" << endl;
else
cout << "NO" << endl;
return 0;
}