結果

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

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 106 ms
53,956 KB
testcase_01 AC 103 ms
53,876 KB
testcase_02 AC 98 ms
52,728 KB
testcase_03 AC 109 ms
54,248 KB
testcase_04 AC 115 ms
54,264 KB
testcase_05 AC 140 ms
56,456 KB
testcase_06 AC 101 ms
52,540 KB
testcase_07 WA -
testcase_08 AC 127 ms
55,992 KB
testcase_09 AC 159 ms
57,152 KB
testcase_10 AC 132 ms
53,992 KB
testcase_11 AC 127 ms
53,300 KB
testcase_12 AC 157 ms
56,684 KB
testcase_13 AC 98 ms
52,932 KB
testcase_14 AC 105 ms
53,372 KB
testcase_15 AC 107 ms
53,924 KB
testcase_16 AC 106 ms
53,816 KB
testcase_17 AC 109 ms
54,092 KB
testcase_18 AC 129 ms
53,508 KB
testcase_19 AC 138 ms
54,052 KB
testcase_20 AC 153 ms
56,968 KB
testcase_21 AC 179 ms
57,016 KB
testcase_22 AC 192 ms
56,748 KB
testcase_23 AC 124 ms
54,220 KB
testcase_24 AC 156 ms
56,812 KB
testcase_25 AC 136 ms
53,856 KB
testcase_26 AC 140 ms
56,784 KB
testcase_27 AC 156 ms
56,648 KB
testcase_28 AC 130 ms
56,112 KB
testcase_29 AC 158 ms
56,740 KB
testcase_30 AC 141 ms
56,912 KB
testcase_31 AC 155 ms
56,480 KB
testcase_32 AC 136 ms
56,732 KB
testcase_33 AC 140 ms
56,024 KB
testcase_34 AC 130 ms
56,632 KB
testcase_35 AC 147 ms
56,768 KB
testcase_36 AC 105 ms
54,144 KB
testcase_37 AC 106 ms
54,124 KB
testcase_38 AC 107 ms
53,876 KB
testcase_39 AC 105 ms
53,044 KB
testcase_40 AC 107 ms
54,000 KB
testcase_41 AC 105 ms
53,732 KB
testcase_42 AC 105 ms
52,972 KB
testcase_43 AC 122 ms
53,920 KB
testcase_44 AC 128 ms
56,604 KB
testcase_45 AC 98 ms
52,952 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