結果

問題 No.351 市松スライドパズル
ユーザー yukirinyukirin
提出日時 2016-03-12 01:49:14
言語 Go
(1.22.1)
結果
WA  
実行時間 -
コード長 684 bytes
コンパイル時間 13,034 ms
コンパイル使用メモリ 220,548 KB
実行使用メモリ 42,848 KB
最終ジャッジ日時 2024-04-19 07:04:11
合計ジャッジ時間 16,565 ms
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 150 ms
41,216 KB
testcase_01 AC 3 ms
5,376 KB
testcase_02 AC 2 ms
5,376 KB
testcase_03 AC 2 ms
5,376 KB
testcase_04 AC 1 ms
5,376 KB
testcase_05 AC 1 ms
5,376 KB
testcase_06 AC 1 ms
5,376 KB
testcase_07 AC 1 ms
5,376 KB
testcase_08 AC 1 ms
5,376 KB
testcase_09 WA -
testcase_10 WA -
testcase_11 WA -
testcase_12 WA -
testcase_13 WA -
testcase_14 AC 169 ms
40,448 KB
testcase_15 AC 172 ms
41,088 KB
testcase_16 AC 169 ms
41,216 KB
testcase_17 AC 172 ms
41,088 KB
testcase_18 AC 167 ms
41,216 KB
testcase_19 AC 169 ms
41,216 KB
testcase_20 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

package main

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

var sc = bufio.NewScanner(os.Stdin)

func main() {
	sc.Split(bufio.ScanWords)
	h, w, n := nextInt(), nextInt(), nextInt()
	ns := make([][]int, n)

	for i := range ns {
		ns[i] = []int{int(nextLine()[0]), nextInt()}
	}

	x, y := 0, 0
	for i := n - 1; i >= 0; i-- {
		if ns[i][0] == 'R' {
			if y != ns[i][1] {
				continue
			}
			x = x + w - 1%w
			continue
		}

		if x != ns[i][1] {
			continue
		}
		y = y + h - 1%h
	}

	if (x+y)&1 == 1 {
		fmt.Println("black")
		return
	}
	fmt.Println("white")
}

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

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