結果
問題 | No.179 塗り分け |
ユーザー | kenkoooo |
提出日時 | 2015-04-18 00:53:30 |
言語 | Java21 (openjdk 21) |
結果 |
WA
|
実行時間 | - |
コード長 | 1,354 bytes |
コンパイル時間 | 2,141 ms |
コンパイル使用メモリ | 78,200 KB |
実行使用メモリ | 59,176 KB |
最終ジャッジ日時 | 2024-04-10 12:15:26 |
合計ジャッジ時間 | 10,761 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge5 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 135 ms
54,204 KB |
testcase_01 | AC | 134 ms
54,348 KB |
testcase_02 | AC | 135 ms
54,296 KB |
testcase_03 | AC | 133 ms
54,096 KB |
testcase_04 | AC | 119 ms
53,044 KB |
testcase_05 | AC | 136 ms
54,220 KB |
testcase_06 | AC | 135 ms
54,308 KB |
testcase_07 | AC | 140 ms
54,300 KB |
testcase_08 | WA | - |
testcase_09 | WA | - |
testcase_10 | AC | 139 ms
53,872 KB |
testcase_11 | AC | 137 ms
54,000 KB |
testcase_12 | AC | 221 ms
57,116 KB |
testcase_13 | AC | 115 ms
52,868 KB |
testcase_14 | AC | 132 ms
54,204 KB |
testcase_15 | AC | 130 ms
54,248 KB |
testcase_16 | WA | - |
testcase_17 | AC | 131 ms
54,052 KB |
testcase_18 | AC | 163 ms
54,180 KB |
testcase_19 | AC | 145 ms
54,240 KB |
testcase_20 | AC | 141 ms
54,180 KB |
testcase_21 | AC | 137 ms
54,296 KB |
testcase_22 | AC | 196 ms
57,000 KB |
testcase_23 | AC | 140 ms
54,148 KB |
testcase_24 | AC | 180 ms
57,260 KB |
testcase_25 | AC | 137 ms
54,140 KB |
testcase_26 | WA | - |
testcase_27 | AC | 204 ms
57,040 KB |
testcase_28 | WA | - |
testcase_29 | AC | 200 ms
56,708 KB |
testcase_30 | WA | - |
testcase_31 | AC | 177 ms
56,996 KB |
testcase_32 | AC | 171 ms
56,936 KB |
testcase_33 | AC | 233 ms
56,640 KB |
testcase_34 | WA | - |
testcase_35 | AC | 216 ms
56,628 KB |
testcase_36 | AC | 129 ms
54,304 KB |
testcase_37 | AC | 132 ms
54,048 KB |
testcase_38 | AC | 128 ms
54,152 KB |
testcase_39 | AC | 126 ms
54,168 KB |
testcase_40 | AC | 114 ms
52,876 KB |
testcase_41 | AC | 126 ms
54,268 KB |
testcase_42 | AC | 131 ms
54,176 KB |
testcase_43 | AC | 148 ms
54,336 KB |
testcase_44 | AC | 166 ms
56,444 KB |
testcase_45 | AC | 128 ms
54,100 KB |
ソースコード
import java.util.Scanner; public class Main { public static void main(String[] args) throws Exception { Scanner sc = new Scanner(System.in); int H = sc.nextInt(); int W = sc.nextInt(); char[][] map = new char[H][]; for (int i = 0; i < map.length; i++) { map[i] = sc.next().toCharArray(); } int cnt = 0; for (int i = 0; i < map.length; i++) { for (int j = 0; j < map[i].length; j++) { if (map[i][j] == '#') { cnt++; } } } if (cnt % 2 == 1 || cnt == 0) { System.out.println("NO"); return; } for (int x = 0; x < H - 1; x++) { for (int y = 0; y < W - 1; y++) { if (x == 0 && y == 0) { continue; } if (check(x, y, map)) { System.out.println("YES"); return; } } } System.out.println("NO"); } static boolean check(int x, int y, char[][] origin) { char[][] map = new char[origin.length][origin[0].length]; for (int i = 0; i < map.length; i++) { for (int j = 0; j < map[i].length; j++) { map[i][j] = origin[i][j]; } } for (int i = 0; i < map.length; i++) { for (int j = 0; j < map[i].length; j++) { int h = i + x; int w = j + y; if (map[i][j] == '#') { if (h >= map.length || w >= map[i].length || map[h][w] != '#') { return false; } map[i][j] = '.'; map[h][w] = '.'; } } } return true; } }