結果

問題 No.179 塗り分け
ユーザー kuuso1kuuso1
提出日時 2015-04-05 23:57:48
言語 C#(csc)
(csc 3.9.0)
結果
AC  
実行時間 60 ms / 3,000 ms
コード長 1,600 bytes
コンパイル時間 2,351 ms
コンパイル使用メモリ 103,164 KB
実行使用メモリ 26,884 KB
最終ジャッジ日時 2023-09-30 20:35:59
合計ジャッジ時間 6,512 ms
ジャッジサーバーID
(参考情報)
judge11 / judge14
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 55 ms
20,768 KB
testcase_01 AC 55 ms
20,628 KB
testcase_02 AC 55 ms
20,720 KB
testcase_03 AC 56 ms
22,752 KB
testcase_04 AC 55 ms
20,876 KB
testcase_05 AC 55 ms
20,692 KB
testcase_06 AC 55 ms
20,628 KB
testcase_07 AC 56 ms
22,660 KB
testcase_08 AC 57 ms
20,788 KB
testcase_09 AC 57 ms
18,588 KB
testcase_10 AC 56 ms
20,776 KB
testcase_11 AC 56 ms
20,652 KB
testcase_12 AC 60 ms
26,884 KB
testcase_13 AC 56 ms
20,836 KB
testcase_14 AC 56 ms
20,632 KB
testcase_15 AC 56 ms
22,672 KB
testcase_16 AC 55 ms
20,692 KB
testcase_17 AC 55 ms
20,808 KB
testcase_18 AC 57 ms
22,764 KB
testcase_19 AC 56 ms
20,720 KB
testcase_20 AC 58 ms
22,748 KB
testcase_21 AC 56 ms
20,884 KB
testcase_22 AC 56 ms
18,808 KB
testcase_23 AC 57 ms
22,848 KB
testcase_24 AC 57 ms
22,752 KB
testcase_25 AC 57 ms
20,824 KB
testcase_26 AC 57 ms
20,572 KB
testcase_27 AC 57 ms
20,820 KB
testcase_28 AC 56 ms
22,688 KB
testcase_29 AC 57 ms
22,716 KB
testcase_30 AC 56 ms
20,796 KB
testcase_31 AC 57 ms
20,704 KB
testcase_32 AC 57 ms
22,624 KB
testcase_33 AC 57 ms
22,684 KB
testcase_34 AC 55 ms
20,784 KB
testcase_35 AC 57 ms
22,788 KB
testcase_36 AC 57 ms
20,624 KB
testcase_37 AC 55 ms
20,636 KB
testcase_38 AC 55 ms
22,680 KB
testcase_39 AC 55 ms
20,776 KB
testcase_40 AC 55 ms
20,636 KB
testcase_41 AC 56 ms
20,768 KB
testcase_42 AC 55 ms
22,740 KB
testcase_43 AC 55 ms
20,716 KB
testcase_44 AC 56 ms
22,676 KB
testcase_45 AC 55 ms
20,752 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Microsoft (R) Visual C# Compiler version 3.9.0-6.21124.20 (db94f4cc)
Copyright (C) Microsoft Corporation. All rights reserved.

ソースコード

diff #

using System;
using System.Collections;
using System.Collections.Generic;
 
class TEST{
	static void Main(){
		Sol mySol =new Sol();
		mySol.Solve();
	}
}

class Sol{
	public void Solve(){
		found=false;
		int i0=-1;int j0=-1;
		for(int i=0;i<N;i++){
			for(int j=0;j<M;j++){
				if(S[i][j]=='.')continue;
				if(i0==-1){
					i0=i;j0=j;
					continue;
				}
				if(!found){
					check(i-i0,j-j0);
				}
			}
		}
		Console.WriteLine(found?"YES":"NO");
	}
	
	void check(int offi,int offj){
		if(found)return;
		bool[,] brd=new bool[N,M];
		bool chk=true;
		for(int i=0;i<N;i++){
			for(int j=0;j<M;j++){
				if(S[i][j]=='.')continue;
				if(brd[i,j]==true)continue;
				if(i+offi<N && i+offi>=0 && j+offj<M && j+offj>=0){
					brd[i,j]=true;
					if(S[i+offi][j+offj]=='.')return;
					brd[i+offi,j+offj]=true;
				}else{
					return;
				}
			}
		}
		if(chk)found=true;
	}
	
	
	
	
	bool found;
	
	int N,M;
	String[] S;
	public Sol(){
		var d=ria();
		N=d[0];M=d[1];
		S=new String[N];
		for(int i=0;i<N;i++)S[i]=rs();
	}




	static String rs(){return Console.ReadLine();}
	static int ri(){return int.Parse(Console.ReadLine());}
	static long rl(){return long.Parse(Console.ReadLine());}
	static double rd(){return double.Parse(Console.ReadLine());}
	static String[] rsa(){return Console.ReadLine().Split(' ');}
	static int[] ria(){return Array.ConvertAll(Console.ReadLine().Split(' '),e=>int.Parse(e));}
	static long[] rla(){return Array.ConvertAll(Console.ReadLine().Split(' '),e=>long.Parse(e));}
	static double[] rda(){return Array.ConvertAll(Console.ReadLine().Split(' '),e=>double.Parse(e));}
}
0