結果

問題 No.179 塗り分け
ユーザー htensaihtensai
提出日時 2020-05-07 18:04:52
言語 Java21
(openjdk 21)
結果
WA  
実行時間 -
コード長 1,245 bytes
コンパイル時間 1,906 ms
コンパイル使用メモリ 73,860 KB
実行使用メモリ 61,196 KB
最終ジャッジ日時 2023-09-16 08:02:39
合計ジャッジ時間 9,853 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 123 ms
55,512 KB
testcase_01 AC 123 ms
55,700 KB
testcase_02 AC 121 ms
55,876 KB
testcase_03 AC 122 ms
55,896 KB
testcase_04 AC 120 ms
55,700 KB
testcase_05 AC 129 ms
57,908 KB
testcase_06 AC 124 ms
55,880 KB
testcase_07 WA -
testcase_08 AC 160 ms
58,608 KB
testcase_09 WA -
testcase_10 AC 127 ms
53,880 KB
testcase_11 AC 127 ms
55,772 KB
testcase_12 AC 149 ms
58,100 KB
testcase_13 AC 120 ms
55,720 KB
testcase_14 AC 126 ms
55,808 KB
testcase_15 AC 119 ms
55,896 KB
testcase_16 AC 120 ms
55,872 KB
testcase_17 AC 120 ms
56,276 KB
testcase_18 AC 129 ms
55,884 KB
testcase_19 AC 129 ms
55,704 KB
testcase_20 AC 175 ms
58,536 KB
testcase_21 AC 174 ms
58,800 KB
testcase_22 AC 172 ms
58,092 KB
testcase_23 AC 128 ms
56,020 KB
testcase_24 AC 150 ms
58,068 KB
testcase_25 AC 127 ms
55,460 KB
testcase_26 WA -
testcase_27 AC 166 ms
58,660 KB
testcase_28 WA -
testcase_29 AC 159 ms
58,148 KB
testcase_30 WA -
testcase_31 AC 158 ms
58,192 KB
testcase_32 AC 134 ms
58,028 KB
testcase_33 AC 197 ms
58,212 KB
testcase_34 WA -
testcase_35 AC 165 ms
58,368 KB
testcase_36 AC 119 ms
55,744 KB
testcase_37 AC 119 ms
55,516 KB
testcase_38 AC 119 ms
55,848 KB
testcase_39 AC 120 ms
56,072 KB
testcase_40 AC 119 ms
55,756 KB
testcase_41 AC 119 ms
55,724 KB
testcase_42 AC 120 ms
55,948 KB
testcase_43 AC 124 ms
55,856 KB
testcase_44 AC 130 ms
58,056 KB
testcase_45 AC 119 ms
55,776 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.*;

public class Main {
	public static void main (String[] args) {
		Scanner sc = new Scanner(System.in);
		int h = sc.nextInt();
		int w = sc.nextInt();
		boolean[][] field = new boolean[h][w];
		for (int i = 0; i < h; i++) {
		    char[] arr = sc.next().toCharArray();
		    for (int j = 0; j < w; j++) {
		        field[i][j] = (arr[j] == '#');
		    }
		}
		for (int i = 0; i < h; i++) {
		    for (int j = 0; j < w; j++) {
		        if (i == 0 && j == 0) {
		            continue;
		        }
		        boolean[][] tmp = new boolean[h][];
		        for (int k = 0; k < h; k++) {
		            tmp[k] = (boolean[])(field[k].clone());
		        }
		        boolean flag = true;
		        for (int a = 0; a < h && flag; a++) {
		            for (int b = 0; b < w && flag; b++) {
		                if (tmp[a][b]) {
		                    if (a + i >= h || b + j >= w || !tmp[a + i][b + j]) {
		                        flag = false;
		                        break;
		                    }
		                    tmp[a + i][b + j] = false;
		                }
		            }
		        }
		        if (flag) {
		            System.out.println("YES");
		            return;
		        }
		    }
		}
		System.out.println("NO");
	}
}
0