結果

問題 No.179 塗り分け
ユーザー 👑 はまやんはまやんはまやんはまやん
提出日時 2015-06-19 16:14:42
言語 Java21
(openjdk 21)
結果
WA  
実行時間 -
コード長 1,339 bytes
コンパイル時間 1,831 ms
コンパイル使用メモリ 78,648 KB
実行使用メモリ 57,136 KB
最終ジャッジ日時 2024-04-10 12:25:09
合計ジャッジ時間 8,935 ms
ジャッジサーバーID
(参考情報)
judge3 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 104 ms
54,196 KB
testcase_01 AC 108 ms
54,024 KB
testcase_02 AC 105 ms
54,068 KB
testcase_03 AC 96 ms
54,284 KB
testcase_04 AC 97 ms
52,816 KB
testcase_05 AC 138 ms
56,352 KB
testcase_06 AC 117 ms
54,308 KB
testcase_07 AC 145 ms
57,136 KB
testcase_08 AC 143 ms
57,116 KB
testcase_09 WA -
testcase_10 AC 103 ms
53,116 KB
testcase_11 AC 114 ms
53,988 KB
testcase_12 AC 150 ms
56,844 KB
testcase_13 AC 103 ms
52,856 KB
testcase_14 AC 101 ms
52,980 KB
testcase_15 AC 102 ms
53,456 KB
testcase_16 AC 100 ms
54,812 KB
testcase_17 AC 105 ms
54,116 KB
testcase_18 AC 134 ms
54,124 KB
testcase_19 AC 138 ms
54,208 KB
testcase_20 AC 140 ms
56,996 KB
testcase_21 AC 144 ms
56,412 KB
testcase_22 AC 160 ms
56,712 KB
testcase_23 AC 114 ms
54,040 KB
testcase_24 AC 149 ms
56,780 KB
testcase_25 AC 112 ms
54,140 KB
testcase_26 WA -
testcase_27 AC 171 ms
57,096 KB
testcase_28 WA -
testcase_29 AC 168 ms
56,972 KB
testcase_30 WA -
testcase_31 AC 188 ms
57,008 KB
testcase_32 AC 145 ms
56,988 KB
testcase_33 AC 154 ms
56,644 KB
testcase_34 WA -
testcase_35 AC 157 ms
56,588 KB
testcase_36 AC 107 ms
54,128 KB
testcase_37 AC 107 ms
53,840 KB
testcase_38 AC 115 ms
54,024 KB
testcase_39 AC 105 ms
54,144 KB
testcase_40 AC 107 ms
54,224 KB
testcase_41 AC 96 ms
52,944 KB
testcase_42 AC 107 ms
54,224 KB
testcase_43 AC 130 ms
54,072 KB
testcase_44 AC 132 ms
56,852 KB
testcase_45 AC 97 ms
53,012 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.awt.Point;
import java.io.FileInputStream;
import java.io.PrintStream;
import java.util.ArrayList;
import java.util.Scanner;

public class Main {
	
	static int h, w;
	static int[][] map;
	static int count;
	
	static void start()
	{
		for(int dy = 0;dy < h;dy++)
			for(int dx = 0;dx < w;dx++)
			{
				if(dx == 0 && dy == 0) continue;
				
				int[][] mapp = new int[h][w];
				int cc = 0;
				for(int y = 0;y < h;y++)
					for(int x= 0;x < w;x++)
						mapp[y][x] = 0;
				
				for(int y = 0;y < (h-dy);y++)
					for(int x = 0;x < (w-dx);x++)
					{
						if(mapp[y][x] == 1) continue;
						if(map[y][x] == 0) continue;
						if(map[y+dy][x+dx] == 0) continue;
						
						mapp[y][x] = 1;
						mapp[y+dy][x+dx] = 1;
						cc += 2;
						if(cc == count)
						{
							System.out.println("YES");
							return;
						}
					}
			}
		
		System.out.println("NO");
	}
	
	public static void main(String[] args)
	{
		Scanner sca = new Scanner(System.in);
		
		while(true)
		{
			h = sca.nextInt();
			w = sca.nextInt();
			
			map = new int[h][w];
			count = 0;
			for(int y = 0;y < h;y++)
			{
				String str = sca.next();
				for(int x = 0;x < w;x++)
				{
					if(str.charAt(x) == '#')
					{
						map[y][x] = 1;
						count++;
					}
					else
					{
						map[y][x] = 0;
					}
				}
			}
			
			start();
			break;
		}
	}
}
0