結果

問題 No.179 塗り分け
ユーザー chiho_miyakochiho_miyako
提出日時 2015-04-21 13:21:52
言語 Java21
(openjdk 21)
結果
WA  
実行時間 -
コード長 2,038 bytes
コンパイル時間 2,195 ms
コンパイル使用メモリ 77,560 KB
実行使用メモリ 56,412 KB
最終ジャッジ日時 2024-04-10 12:15:40
合計ジャッジ時間 9,274 ms
ジャッジサーバーID
(参考情報)
judge5 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 111 ms
54,028 KB
testcase_01 AC 103 ms
53,716 KB
testcase_02 AC 105 ms
54,188 KB
testcase_03 AC 95 ms
52,816 KB
testcase_04 AC 99 ms
52,864 KB
testcase_05 AC 136 ms
54,268 KB
testcase_06 AC 99 ms
53,044 KB
testcase_07 WA -
testcase_08 AC 186 ms
54,776 KB
testcase_09 WA -
testcase_10 AC 114 ms
53,772 KB
testcase_11 AC 113 ms
54,084 KB
testcase_12 AC 167 ms
54,424 KB
testcase_13 AC 108 ms
53,892 KB
testcase_14 AC 101 ms
52,928 KB
testcase_15 AC 103 ms
54,116 KB
testcase_16 AC 108 ms
54,132 KB
testcase_17 AC 108 ms
53,996 KB
testcase_18 AC 138 ms
54,336 KB
testcase_19 AC 134 ms
54,432 KB
testcase_20 AC 179 ms
54,952 KB
testcase_21 AC 147 ms
54,852 KB
testcase_22 AC 157 ms
54,936 KB
testcase_23 AC 115 ms
54,232 KB
testcase_24 AC 173 ms
54,832 KB
testcase_25 AC 105 ms
52,820 KB
testcase_26 WA -
testcase_27 AC 182 ms
54,976 KB
testcase_28 WA -
testcase_29 AC 200 ms
54,856 KB
testcase_30 WA -
testcase_31 AC 205 ms
55,024 KB
testcase_32 AC 173 ms
54,624 KB
testcase_33 AC 220 ms
55,048 KB
testcase_34 WA -
testcase_35 AC 201 ms
55,008 KB
testcase_36 AC 104 ms
54,380 KB
testcase_37 AC 96 ms
53,076 KB
testcase_38 AC 109 ms
54,284 KB
testcase_39 AC 107 ms
54,064 KB
testcase_40 AC 108 ms
54,112 KB
testcase_41 AC 108 ms
54,084 KB
testcase_42 AC 109 ms
53,984 KB
testcase_43 AC 130 ms
54,236 KB
testcase_44 AC 130 ms
54,340 KB
testcase_45 AC 114 ms
54,024 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception {
        Scanner koko = new Scanner(System.in);
        int h = koko.nextInt();
        int w = koko.nextInt();
        boolean [][] moto = new boolean[h][w];
        boolean[][] color = new boolean[h][w];
        String[] s = new String[h];
        for(int i=0; i<h; i++){
            s[i] = koko.next();
            char[] ss = s[i].toCharArray();
            for(int j=0; j<w; j++){
                if(ss[j]=='.'){
                    moto[i][j]=true;
                    color[i][j]=true;
                }
            }
        }
        boolean bflag = false;
loop2:  for(int i=0; i<h; i++){//ぬり平行移動(たて
            for(int j=0; j<w; j++){//ぬり平行移動(よこ
                if(i!=0||j!=0){
                    for(int a=0; a<h; a++){
                        for(int b=0; b<w; b++){
                            color[a][b]=moto[a][b];
                        }
                    }
                    for(int k=0; k+i<h; k++){
                        for(int l=0; l+j<w; l++){
                            if(!color[k][l]&&!color[k+i][l+j]){
                                color[k][l]=true;
                                color[k+i][l+j]=true;
                            }
                        }
                    }
                    boolean flag = false;
                    for(int m=0; m<h; m++){
                        for(int n=0; n<w; n++){
                            if(!color[m][n]){
                                flag = true;
                                break;
                            }
                        }
                    }
                    if(!flag){
                        System.out.println("YES");
                        bflag = true;
                        break loop2;
                    }
                    
                }
            }
        }
        if(!bflag){
            System.out.println("NO");
        }
    }
}
        
        
0