結果

問題 No.179 塗り分け
ユーザー Lepton_sLepton_s
提出日時 2015-04-05 23:35:54
言語 C++11
(gcc 11.4.0)
結果
WA  
実行時間 -
コード長 1,173 bytes
コンパイル時間 660 ms
コンパイル使用メモリ 83,984 KB
実行使用メモリ 6,948 KB
最終ジャッジ日時 2024-04-10 11:15:42
合計ジャッジ時間 2,095 ms
ジャッジサーバーID
(参考情報)
judge5 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
6,816 KB
testcase_01 AC 1 ms
6,944 KB
testcase_02 AC 1 ms
6,940 KB
testcase_03 AC 1 ms
6,940 KB
testcase_04 AC 1 ms
6,940 KB
testcase_05 AC 2 ms
6,940 KB
testcase_06 AC 2 ms
6,940 KB
testcase_07 WA -
testcase_08 AC 6 ms
6,940 KB
testcase_09 WA -
testcase_10 AC 2 ms
6,944 KB
testcase_11 AC 2 ms
6,940 KB
testcase_12 AC 6 ms
6,940 KB
testcase_13 AC 2 ms
6,940 KB
testcase_14 AC 1 ms
6,944 KB
testcase_15 AC 1 ms
6,944 KB
testcase_16 AC 1 ms
6,940 KB
testcase_17 AC 2 ms
6,940 KB
testcase_18 AC 2 ms
6,944 KB
testcase_19 AC 2 ms
6,940 KB
testcase_20 AC 7 ms
6,940 KB
testcase_21 AC 7 ms
6,944 KB
testcase_22 AC 8 ms
6,940 KB
testcase_23 AC 2 ms
6,944 KB
testcase_24 AC 7 ms
6,944 KB
testcase_25 AC 1 ms
6,944 KB
testcase_26 WA -
testcase_27 AC 6 ms
6,944 KB
testcase_28 WA -
testcase_29 AC 7 ms
6,940 KB
testcase_30 WA -
testcase_31 AC 7 ms
6,944 KB
testcase_32 AC 3 ms
6,944 KB
testcase_33 AC 7 ms
6,940 KB
testcase_34 WA -
testcase_35 AC 6 ms
6,948 KB
testcase_36 AC 1 ms
6,944 KB
testcase_37 AC 1 ms
6,944 KB
testcase_38 AC 2 ms
6,944 KB
testcase_39 AC 1 ms
6,940 KB
testcase_40 AC 2 ms
6,940 KB
testcase_41 AC 2 ms
6,940 KB
testcase_42 AC 2 ms
6,940 KB
testcase_43 AC 2 ms
6,944 KB
testcase_44 AC 2 ms
6,944 KB
testcase_45 AC 2 ms
6,940 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <algorithm>
#include <climits>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <ctime>
#include <iostream>
#include <sstream>
#include <functional>
#include <map>
#include <string>
#include <cstring>
#include <vector>
#include <queue>
#include <stack>
#include <deque>
#include <set>
#include <list>
#include <numeric>
using namespace std;
const double PI = 3.14159265358979323846;
const double EPS = 1e-12;
const int INF = 1<<25;
typedef pair<int,int> P;
typedef long long ll;
typedef unsigned long long ull;

int h, w;
string s[200];
string res[2] = {"NO", "YES"};

bool check(int dx, int dy){
	int g[60][60];
	for(int i = 0; i < h; i++)
		for(int j = 0; j < w; j++)
			g[i][j] = s[i][j]=='#';
	for(int i = 0; i < h; i++){
		for(int j = 0; j < w; j++){
			if(g[i][j]){
				int i2 = i+dx, j2 = j+dy;
				if(i2>=h || j2>=w || !g[i2][j2]) return false;
				g[i2][j2] = 0;
			}
		}
	}
	return true;
}

int main(){
	cin>>h>>w;
	for(int i = 0; i < h; i++) cin>>s[i];
	bool ok = false;
	for(int i = 0; i < h; i++){
		for(int j = (i==0); j < w; j++){
			if(check(i, j)){
				ok = true;
				i = h;
				break;
			}
		}
	}
	cout<<res[ok]<<endl;
	return 0;
}
0