結果

問題 No.179 塗り分け
ユーザー kou6839kou6839
提出日時 2015-06-21 02:25:31
言語 Java21
(openjdk 21)
結果
WA  
実行時間 -
コード長 1,289 bytes
コンパイル時間 1,823 ms
コンパイル使用メモリ 77,892 KB
実行使用メモリ 57,084 KB
最終ジャッジ日時 2024-10-02 14:30:20
合計ジャッジ時間 9,170 ms
ジャッジサーバーID
(参考情報)
judge4 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 118 ms
52,812 KB
testcase_01 AC 118 ms
54,008 KB
testcase_02 AC 106 ms
52,636 KB
testcase_03 AC 117 ms
54,160 KB
testcase_04 AC 118 ms
53,944 KB
testcase_05 AC 141 ms
56,752 KB
testcase_06 AC 109 ms
52,976 KB
testcase_07 WA -
testcase_08 AC 151 ms
56,812 KB
testcase_09 AC 158 ms
57,084 KB
testcase_10 AC 146 ms
53,904 KB
testcase_11 AC 146 ms
54,244 KB
testcase_12 AC 162 ms
56,840 KB
testcase_13 AC 103 ms
52,564 KB
testcase_14 AC 104 ms
52,620 KB
testcase_15 AC 113 ms
54,056 KB
testcase_16 AC 117 ms
53,916 KB
testcase_17 AC 117 ms
53,944 KB
testcase_18 AC 128 ms
53,668 KB
testcase_19 AC 143 ms
53,968 KB
testcase_20 AC 151 ms
56,248 KB
testcase_21 AC 187 ms
57,060 KB
testcase_22 AC 197 ms
56,812 KB
testcase_23 AC 142 ms
54,296 KB
testcase_24 AC 157 ms
56,784 KB
testcase_25 AC 129 ms
53,720 KB
testcase_26 AC 151 ms
56,780 KB
testcase_27 AC 143 ms
56,376 KB
testcase_28 AC 149 ms
56,236 KB
testcase_29 AC 162 ms
56,836 KB
testcase_30 AC 129 ms
55,988 KB
testcase_31 AC 146 ms
56,268 KB
testcase_32 AC 127 ms
56,356 KB
testcase_33 AC 148 ms
56,180 KB
testcase_34 AC 143 ms
56,660 KB
testcase_35 AC 159 ms
56,832 KB
testcase_36 AC 119 ms
54,160 KB
testcase_37 AC 111 ms
53,832 KB
testcase_38 AC 111 ms
53,576 KB
testcase_39 AC 119 ms
53,952 KB
testcase_40 AC 111 ms
53,384 KB
testcase_41 AC 117 ms
53,912 KB
testcase_42 AC 116 ms
54,028 KB
testcase_43 AC 148 ms
54,052 KB
testcase_44 AC 128 ms
56,284 KB
testcase_45 AC 111 ms
53,444 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.io.*;
import java.util.*;


public class Main {
	static char[][] copy(char[][] origin){
		char[][] copy = new char[origin.length][origin[0].length];
		
		for(int i=0;i<origin.length;i++){
			for(int j=0;j<origin[0].length;j++){
				copy[i][j]=origin[i][j];
			}
		}
		return copy;
	}
    public static void main(String[] args){
        // TODO 自動生成されたメソッド・スタブ
    	Scanner sc = new Scanner(System.in);
    	
    	int r = sc.nextInt();
    	int c = sc.nextInt();
    	
    	char[][] panel = new char[r][c];
    	for(int i=0;i<r;i++) panel[i]=sc.next().toCharArray();
    	
    	for(int i=0;i<r;i++){
    		t:for(int j=-c+1;j<c;j++){
    			if(i==0 && j==0) continue;
    			char[][] copy = copy(panel);
    			for(int k=0;k<r;k++){
    				for(int l=0;l<c;l++){
    					if(copy[k][l]=='#'){
    						copy[k][l]='r';
    						if(k+i>=0 && k+i<r && l+j>=0 && l+j<c && copy[k+i][l+j]=='#'){
    							copy[k+i][l+j]='b';
    						}else{
    							continue t;
    						}
    					}
    				}
    			}
    			for(int k=0;k<r;k++){
    				for(int l=0;l<c;l++){
    					if(copy[k][l]=='#'){
    						continue t;
    					}
    				}
    			}
    			System.out.println("YES");
    			return;
    		}
    	}
    	System.out.println("NO");
    }
}
0