結果

問題 No.179 塗り分け
ユーザー shinwisteriashinwisteria
提出日時 2017-03-28 21:03:20
言語 Java21
(openjdk 21)
結果
WA  
実行時間 -
コード長 1,190 bytes
コンパイル時間 4,091 ms
コンパイル使用メモリ 78,124 KB
実行使用メモリ 54,692 KB
最終ジャッジ日時 2024-04-14 06:19:58
合計ジャッジ時間 13,187 ms
ジャッジサーバーID
(参考情報)
judge2 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 133 ms
53,904 KB
testcase_01 AC 133 ms
54,140 KB
testcase_02 AC 133 ms
54,176 KB
testcase_03 AC 133 ms
54,248 KB
testcase_04 AC 136 ms
54,276 KB
testcase_05 AC 140 ms
54,072 KB
testcase_06 AC 166 ms
54,428 KB
testcase_07 WA -
testcase_08 AC 186 ms
54,420 KB
testcase_09 WA -
testcase_10 AC 193 ms
54,360 KB
testcase_11 AC 188 ms
54,196 KB
testcase_12 AC 189 ms
54,572 KB
testcase_13 AC 136 ms
54,292 KB
testcase_14 AC 137 ms
54,024 KB
testcase_15 AC 136 ms
54,040 KB
testcase_16 AC 133 ms
54,476 KB
testcase_17 WA -
testcase_18 AC 178 ms
54,360 KB
testcase_19 AC 177 ms
54,244 KB
testcase_20 AC 141 ms
53,984 KB
testcase_21 AC 144 ms
54,116 KB
testcase_22 AC 215 ms
54,332 KB
testcase_23 AC 215 ms
54,408 KB
testcase_24 AC 177 ms
54,216 KB
testcase_25 AC 198 ms
54,244 KB
testcase_26 WA -
testcase_27 AC 186 ms
54,436 KB
testcase_28 WA -
testcase_29 AC 187 ms
54,540 KB
testcase_30 WA -
testcase_31 AC 200 ms
54,488 KB
testcase_32 AC 201 ms
54,268 KB
testcase_33 AC 187 ms
54,428 KB
testcase_34 WA -
testcase_35 AC 191 ms
54,336 KB
testcase_36 AC 135 ms
54,148 KB
testcase_37 AC 135 ms
54,020 KB
testcase_38 AC 134 ms
54,352 KB
testcase_39 AC 133 ms
54,288 KB
testcase_40 AC 131 ms
54,100 KB
testcase_41 AC 132 ms
54,304 KB
testcase_42 AC 132 ms
54,064 KB
testcase_43 AC 163 ms
54,500 KB
testcase_44 AC 174 ms
54,416 KB
testcase_45 AC 138 ms
54,352 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.Scanner;

public class Nuriwake {

	public static void main(String[] args) {
		Scanner s = new Scanner(System.in);
		int H = s.nextInt(), W = s.nextInt(),count = 0;;
		int[][][] color = new int[H][W][2];
		for(int i = 0;i < H;i++){
			String str = s.next();
			for(int j = 0;j < W;j++){
				if(str.charAt(j) == '#'){
					color[i][j][0] = 1;         //1は[0]なら黒、[1]なら青候補
					count++;
				}
			}
		}
		s.close();
		if(count%2 == 1){
			System.out.println("NO");
		}else{
			int redc = count / 2;
			for(int x = 0;x < W;x++){
				for(int y = 0;y < H;y++){
					int c = 0;
					for(int i = 0;i < H-y;i++){
						for(int j = 0;j < W-x;j++){
							if(color[i][j][0] == 1&&color[i+y][j+x][0] == 1&&color[i+y][j+x][1] == 0&&color[i][j][1] == 0){
								color[i+y][j+x][1] = 1;
								c++;
								//System.out.println(i+"  "+j+"  "+y+"  "+x);
							}
							color[i][j][1] = 0;
						}
					}
					for(int i = 0;i<H;i++){
						for(int j = 0;j < W;j++){
							color[i][j][1] = 0;
						}
					}
					if(c == redc){
						count = 0;
					}
				}
			}
			if(count == 0){
				System.out.println("YES");
			}else{
				System.out.println("NO");
			}
		}

	}

}
0