結果
問題 | No.179 塗り分け |
ユーザー | kenkoooo |
提出日時 | 2015-04-18 00:52:00 |
言語 | Java21 (openjdk 21) |
結果 |
WA
|
実行時間 | - |
コード長 | 1,342 bytes |
コンパイル時間 | 2,414 ms |
コンパイル使用メモリ | 77,920 KB |
実行使用メモリ | 57,108 KB |
最終ジャッジ日時 | 2024-04-10 12:14:16 |
合計ジャッジ時間 | 9,589 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge4 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 121 ms
54,228 KB |
testcase_01 | AC | 123 ms
54,072 KB |
testcase_02 | AC | 110 ms
52,980 KB |
testcase_03 | AC | 121 ms
54,004 KB |
testcase_04 | AC | 105 ms
52,768 KB |
testcase_05 | AC | 110 ms
52,740 KB |
testcase_06 | AC | 123 ms
54,232 KB |
testcase_07 | WA | - |
testcase_08 | WA | - |
testcase_09 | WA | - |
testcase_10 | AC | 114 ms
52,704 KB |
testcase_11 | AC | 124 ms
54,108 KB |
testcase_12 | AC | 211 ms
56,932 KB |
testcase_13 | AC | 122 ms
54,124 KB |
testcase_14 | AC | 110 ms
54,476 KB |
testcase_15 | AC | 119 ms
54,096 KB |
testcase_16 | WA | - |
testcase_17 | AC | 116 ms
54,032 KB |
testcase_18 | AC | 142 ms
53,916 KB |
testcase_19 | AC | 141 ms
54,100 KB |
testcase_20 | AC | 126 ms
54,076 KB |
testcase_21 | AC | 114 ms
53,036 KB |
testcase_22 | AC | 187 ms
56,928 KB |
testcase_23 | AC | 117 ms
53,436 KB |
testcase_24 | AC | 160 ms
56,340 KB |
testcase_25 | AC | 129 ms
54,080 KB |
testcase_26 | WA | - |
testcase_27 | AC | 180 ms
56,264 KB |
testcase_28 | WA | - |
testcase_29 | AC | 173 ms
57,064 KB |
testcase_30 | WA | - |
testcase_31 | AC | 163 ms
56,768 KB |
testcase_32 | AC | 144 ms
56,076 KB |
testcase_33 | AC | 202 ms
56,864 KB |
testcase_34 | WA | - |
testcase_35 | AC | 210 ms
57,040 KB |
testcase_36 | AC | 125 ms
54,172 KB |
testcase_37 | AC | 124 ms
53,892 KB |
testcase_38 | AC | 119 ms
54,108 KB |
testcase_39 | AC | 114 ms
53,404 KB |
testcase_40 | AC | 123 ms
54,188 KB |
testcase_41 | AC | 110 ms
52,832 KB |
testcase_42 | AC | 109 ms
52,672 KB |
testcase_43 | AC | 134 ms
54,152 KB |
testcase_44 | AC | 156 ms
56,496 KB |
testcase_45 | AC | 121 ms
54,000 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) { 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; } }