結果
| 問題 |
No.923 オセロきりきざむたん
|
| コンテスト | |
| ユーザー |
yyyuuuummmmaaa1
|
| 提出日時 | 2019-11-11 19:41:28 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
AC
|
| 実行時間 | 32 ms / 2,000 ms |
| コード長 | 2,389 bytes |
| コンパイル時間 | 1,727 ms |
| コンパイル使用メモリ | 164,344 KB |
| 実行使用メモリ | 19,456 KB |
| 最終ジャッジ日時 | 2024-09-15 05:22:18 |
| 合計ジャッジ時間 | 4,189 ms |
|
ジャッジサーバーID (参考情報) |
judge6 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 4 |
| other | AC * 84 |
ソースコード
#include "bits/stdc++.h"
#include<vector>
#include<iostream>
#include<queue>
#include<algorithm>
#include<map>
#include<set>
#include<iomanip>
#include<assert.h>
#include<unordered_map>
#include<unordered_set>
#include<string>
#include<stack>
#include<complex>
#pragma warning(disable:4996)
using namespace std;
using ld = long double;
template<class T>
using Table = vector<vector<T>>;
const ld eps=1e-9;
#define WHATS(var)cout<<__LINE__<<' '<<#var<<"="<<var<<endl;
template<class S, class T> ostream& operator <<(ostream &os, const pair<S, T> v){
os << "( " << v.first << ", " << v.second << ")"; return os;
}
template<class T> ostream& operator <<(ostream &os, const vector<T> &v){
for(int i = 0; i < v.size(); i++){if(i > 0){os << " ";} os << v[i];} return os;
}
template<class T> ostream& operator <<(ostream &os, const vector<vector<T>> &v){
for(int i = 0; i < v.size(); i++){if(i > 0){os << endl;} os << v[i];} return os;
}
template<class T> ostream& operator <<(ostream &os, const vector<set<T>> &v){
for(int i = 0; i < v.size(); i++){if(i > 0){os << endl;} os << v[i];} return os;
}
template<class T> ostream& operator <<(ostream &os, const set<T> &v){
int i=0;
for(auto it:v){
if(i > 0){os << ' ';}
os << it;
i++;
}
return os;
}
/*
1 2 3 4 5 6 7 8 9 10 11 12 13 14
12 1 11
13 3 10
14 5 9
15 7 8
16 2 14
17 4 13
18 6 12
1-12
11 1 10
12 3 9
13 5 8
13 6 7
14 2 12
15 4 11
*/
const int MAX_X=2220;
using ll=long long ;
int H,W;
vector<vector<int>>field;
vector<vector<int>>sums;
int main() {
ios::sync_with_stdio(false);
int H,W;cin>>H>>W;
field=vector<vector<int>>(H,vector<int>(W));
sums=vector<vector<int>>(H+1,vector<int>(W+1));
for(int y=0;y<H;++y){
string st;cin>>st;
for(int x=0;x<W;++x){
field[y][x]=st[x]=='1';
sums[y+1][x+1]=sums[y][x+1]+sums[y+1][x]-sums[y][x]+field[y][x];
}
}
vector<vector<int>>oks(H,vector<int>(W));
oks[0][0]=true;
bool ok=false;
for(int y=0;y<H;++y){
for(int x=0;x<W;++x){
if(oks[y][x]){
{
int xline=sums[y+1][W]-sums[y][W]-sums[y+1][x]+sums[y][x];
if(xline==0||xline==W-x){
}else{
if(y==H-1)ok=true;
else oks[y+1][x]=true;
}
int yline=sums[H][x+1]-sums[H][x]-sums[y][x+1]+sums[y][x];
if(yline==0||yline==H-y){
}else{
if(x==W-1)ok=true;
else oks[y][x+1]=true;
}
}
}
}
}
if(ok)cout<<"YES"<<endl;
else cout<<"NO"<<endl;
return 0;
}
yyyuuuummmmaaa1