結果

問題 No.923 オセロきりきざむたん
ユーザー yyyuuuummmmaaa1yyyuuuummmmaaa1
提出日時 2019-11-11 19:41:28
言語 C++11
(gcc 11.4.0)
結果
AC  
実行時間 33 ms / 2,000 ms
コード長 2,389 bytes
コンパイル時間 1,341 ms
コンパイル使用メモリ 150,176 KB
実行使用メモリ 19,540 KB
最終ジャッジ日時 2023-10-13 08:12:14
合計ジャッジ時間 4,340 ms
ジャッジサーバーID
(参考情報)
judge11 / judge15
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,372 KB
testcase_01 AC 1 ms
4,368 KB
testcase_02 AC 2 ms
4,372 KB
testcase_03 AC 1 ms
4,368 KB
testcase_04 AC 1 ms
4,368 KB
testcase_05 AC 1 ms
4,372 KB
testcase_06 AC 2 ms
4,372 KB
testcase_07 AC 2 ms
4,368 KB
testcase_08 AC 2 ms
4,368 KB
testcase_09 AC 1 ms
4,372 KB
testcase_10 AC 2 ms
4,372 KB
testcase_11 AC 1 ms
4,368 KB
testcase_12 AC 1 ms
4,368 KB
testcase_13 AC 2 ms
4,368 KB
testcase_14 AC 1 ms
4,368 KB
testcase_15 AC 1 ms
4,372 KB
testcase_16 AC 2 ms
4,372 KB
testcase_17 AC 1 ms
4,368 KB
testcase_18 AC 2 ms
4,372 KB
testcase_19 AC 1 ms
4,368 KB
testcase_20 AC 1 ms
4,368 KB
testcase_21 AC 1 ms
4,368 KB
testcase_22 AC 2 ms
4,368 KB
testcase_23 AC 1 ms
4,372 KB
testcase_24 AC 1 ms
4,372 KB
testcase_25 AC 1 ms
4,368 KB
testcase_26 AC 4 ms
4,628 KB
testcase_27 AC 2 ms
4,372 KB
testcase_28 AC 3 ms
4,480 KB
testcase_29 AC 3 ms
4,380 KB
testcase_30 AC 2 ms
4,368 KB
testcase_31 AC 2 ms
4,368 KB
testcase_32 AC 1 ms
4,372 KB
testcase_33 AC 2 ms
4,372 KB
testcase_34 AC 1 ms
4,372 KB
testcase_35 AC 1 ms
4,368 KB
testcase_36 AC 1 ms
4,372 KB
testcase_37 AC 1 ms
4,368 KB
testcase_38 AC 1 ms
4,368 KB
testcase_39 AC 2 ms
4,372 KB
testcase_40 AC 2 ms
4,372 KB
testcase_41 AC 1 ms
4,372 KB
testcase_42 AC 2 ms
4,368 KB
testcase_43 AC 1 ms
4,372 KB
testcase_44 AC 1 ms
4,368 KB
testcase_45 AC 2 ms
4,368 KB
testcase_46 AC 1 ms
4,368 KB
testcase_47 AC 2 ms
4,368 KB
testcase_48 AC 2 ms
4,368 KB
testcase_49 AC 1 ms
4,372 KB
testcase_50 AC 7 ms
5,996 KB
testcase_51 AC 6 ms
6,008 KB
testcase_52 AC 6 ms
5,648 KB
testcase_53 AC 18 ms
11,192 KB
testcase_54 AC 7 ms
5,960 KB
testcase_55 AC 8 ms
6,288 KB
testcase_56 AC 8 ms
6,176 KB
testcase_57 AC 1 ms
4,368 KB
testcase_58 AC 1 ms
4,372 KB
testcase_59 AC 1 ms
4,368 KB
testcase_60 AC 2 ms
4,368 KB
testcase_61 AC 2 ms
4,368 KB
testcase_62 AC 3 ms
4,368 KB
testcase_63 AC 2 ms
4,368 KB
testcase_64 AC 2 ms
4,372 KB
testcase_65 AC 32 ms
19,340 KB
testcase_66 AC 31 ms
19,352 KB
testcase_67 AC 32 ms
19,540 KB
testcase_68 AC 33 ms
19,372 KB
testcase_69 AC 4 ms
4,944 KB
testcase_70 AC 4 ms
4,948 KB
testcase_71 AC 31 ms
19,304 KB
testcase_72 AC 3 ms
4,904 KB
testcase_73 AC 1 ms
4,368 KB
testcase_74 AC 2 ms
4,368 KB
testcase_75 AC 3 ms
4,372 KB
testcase_76 AC 2 ms
4,372 KB
testcase_77 AC 2 ms
4,376 KB
testcase_78 AC 1 ms
4,368 KB
testcase_79 AC 4 ms
4,376 KB
testcase_80 AC 3 ms
4,368 KB
testcase_81 AC 2 ms
4,372 KB
testcase_82 AC 4 ms
4,484 KB
testcase_83 AC 2 ms
4,372 KB
testcase_84 AC 3 ms
4,664 KB
testcase_85 AC 3 ms
4,372 KB
testcase_86 AC 3 ms
4,368 KB
testcase_87 AC 3 ms
4,372 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#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;
}
0