結果

問題 No.86 TVザッピング(2)
ユーザー kano_townkano_town
提出日時 2014-12-07 18:35:04
言語 Java21
(openjdk 21)
結果
WA  
実行時間 -
コード長 813 bytes
コンパイル時間 3,468 ms
コンパイル使用メモリ 74,712 KB
実行使用メモリ 58,092 KB
最終ジャッジ日時 2023-09-02 09:15:30
合計ジャッジ時間 9,532 ms
ジャッジサーバーID
(参考情報)
judge14 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 126 ms
55,556 KB
testcase_01 WA -
testcase_02 WA -
testcase_03 AC 127 ms
55,780 KB
testcase_04 AC 126 ms
55,772 KB
testcase_05 AC 129 ms
55,856 KB
testcase_06 AC 128 ms
55,928 KB
testcase_07 WA -
testcase_08 AC 158 ms
56,580 KB
testcase_09 WA -
testcase_10 WA -
testcase_11 WA -
testcase_12 WA -
testcase_13 AC 130 ms
55,908 KB
testcase_14 AC 156 ms
56,484 KB
testcase_15 AC 156 ms
56,236 KB
testcase_16 AC 158 ms
56,424 KB
testcase_17 AC 132 ms
55,972 KB
testcase_18 AC 131 ms
55,620 KB
testcase_19 AC 132 ms
55,836 KB
testcase_20 WA -
testcase_21 WA -
testcase_22 WA -
testcase_23 AC 158 ms
56,348 KB
testcase_24 WA -
testcase_25 AC 129 ms
55,940 KB
testcase_26 WA -
testcase_27 AC 130 ms
55,824 KB
testcase_28 AC 132 ms
55,992 KB
testcase_29 WA -
testcase_30 AC 131 ms
53,744 KB
testcase_31 AC 131 ms
55,812 KB
testcase_32 AC 131 ms
55,704 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.Scanner;

public class Yukicoder85 {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt(), m = sc.nextInt();
		String[] a = new String[n];
		for (int i = 0; i < n; i++) a[i] = sc.next();

		int oddCount = 0, buf;
		for (int i = 0; i < n; i++) {
			for (int j = 0; j < m; j++) {
				if (a[i].charAt(j) == '#') continue;
				buf = 0;
				if (i - 1 >= 0) buf += a[i - 1].charAt(j) == '.' ? 1 : 0;
				if (i + 1 < n) buf += a[i + 1].charAt(j) == '.' ? 1 : 0;
				if (j - 1 >= 0) buf += a[i].charAt(j - 1) == '.' ? 1 : 0;
				if (j + 1 < m) buf += a[i].charAt(j + 1) == '.' ? 1 : 0;
				if (buf % 2 == 0) oddCount++;
			}
		}
		if (oddCount % 2 == 0)
			System.out.println("YES");
		else 
			System.out.println("NO");
	}
}
0