結果

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

テストケース

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

ソースコード

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(dy<0) j = w-j-1;
			if(g[i][j]){
				int i2 = i+dx, j2 = j+dy;
				if(i2>=h || j2>=w || j2<0 || !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 = -w+1; j < w; j++){
			if(i==0 && j==0) continue;
			if(check(i, j)){
				ok = true;
				i = h;
				break;
			}
		}
	}
	cout<<res[ok]<<endl;
	return 0;
}
0