結果

問題 No.179 塗り分け
ユーザー yukirinyukirin
提出日時 2016-03-05 02:11:10
言語 Go
(1.22.1)
結果
WA  
実行時間 -
コード長 1,013 bytes
コンパイル時間 13,566 ms
コンパイル使用メモリ 238,008 KB
実行使用メモリ 6,948 KB
最終ジャッジ日時 2024-04-14 06:01:07
合計ジャッジ時間 15,165 ms
ジャッジサーバーID
(参考情報)
judge5 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

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([][]rune, h)
	for i := range m {
		m[i] = []rune(nextLine())
	}

	n := rune(2500)
	for i := 0; i < h; i++ {
		for j := 0; j < w; j++ {
			if i == 0 && j == 0 {
				continue
			}
			isP := true
			not := false
			for k, v := range m {
				for l, v2 := range v {
					if v2 == '.' || v2 == n {
						continue
					}

					not = true
					if (v2 == '#' || v2 == n) && (h >= k+i || w >= l+j) {
						isP = false
						break
					}

					if v2 != m[k+i][l+j] {
						isP = false
						break
					}
					m[k+i][l+j], m[k][l] = n, n
				}
				if !isP {
					break
				}
			}

			if isP && not {
				fmt.Println("YES")
				return
			}
		}
		n++
	}
	fmt.Println("NO")
}

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

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