結果

問題 No.179 塗り分け
ユーザー yukirinyukirin
提出日時 2016-03-05 00:50:36
言語 Go
(1.22.1)
結果
WA  
実行時間 -
コード長 1,096 bytes
コンパイル時間 13,952 ms
コンパイル使用メモリ 235,836 KB
実行使用メモリ 6,948 KB
最終ジャッジ日時 2024-04-14 06:00:32
合計ジャッジ時間 15,357 ms
ジャッジサーバーID
(参考情報)
judge2 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
6,812 KB
testcase_01 WA -
testcase_02 AC 1 ms
6,944 KB
testcase_03 WA -
testcase_04 AC 2 ms
6,940 KB
testcase_05 WA -
testcase_06 AC 2 ms
6,940 KB
testcase_07 WA -
testcase_08 AC 2 ms
6,940 KB
testcase_09 WA -
testcase_10 AC 1 ms
6,944 KB
testcase_11 AC 2 ms
6,940 KB
testcase_12 WA -
testcase_13 AC 1 ms
6,940 KB
testcase_14 WA -
testcase_15 AC 1 ms
6,944 KB
testcase_16 AC 1 ms
6,944 KB
testcase_17 AC 1 ms
6,944 KB
testcase_18 AC 1 ms
6,940 KB
testcase_19 AC 2 ms
6,944 KB
testcase_20 WA -
testcase_21 WA -
testcase_22 WA -
testcase_23 AC 1 ms
6,940 KB
testcase_24 WA -
testcase_25 AC 1 ms
6,940 KB
testcase_26 WA -
testcase_27 WA -
testcase_28 WA -
testcase_29 WA -
testcase_30 WA -
testcase_31 AC 1 ms
6,944 KB
testcase_32 AC 1 ms
6,944 KB
testcase_33 WA -
testcase_34 WA -
testcase_35 WA -
testcase_36 WA -
testcase_37 AC 1 ms
6,940 KB
testcase_38 WA -
testcase_39 WA -
testcase_40 WA -
testcase_41 WA -
testcase_42 WA -
testcase_43 AC 2 ms
6,944 KB
testcase_44 AC 1 ms
6,940 KB
testcase_45 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
)

var sc = bufio.NewScanner(os.Stdin)
var rdr = bufio.NewReaderSize(os.Stdin, 1000000)

func main() {
	sc.Split(bufio.ScanWords)
	h, w := nextInt(), nextInt()
	m := make([][]byte, h)
	for i := range m {
		m[i] = []byte(nextLine())
	}

	for i := 0; i < h; i++ {
		for j := 0; j < w; j++ {
			if i == 0 && j == 0 {
				continue
			}
			isPh, isPw := true, true
			if j != 0 {
				for k := 0; k < h; k++ {
					c := 0
					for x, y := 0, k; x < w && y < h; x, y = x+j, y+i {
						if m[y][x] == '#' {
							c++
						}
					}
					if c%2 == 1 {
						isPh = false
						break
					}
				}
			}

			if i != 0 {
				for k := 0; k < w; k++ {
					c := 0
					for x, y := k, 0; x < w && y < h; x, y = x+j, y+i {
						if m[y][x] == '#' {
							c++
						}
					}
					if c%2 == 1 {
						isPw = false
						break
					}
				}
			}
			if isPh && isPw {
				fmt.Println("YES")
				return
			}
		}
	}
	fmt.Println("NO")
}

func nextLine() string {
	sc.Scan()
	return sc.Text()
}

func nextInt() int {
	i, _ := strconv.Atoi(nextLine())
	return i
}
0