結果

問題 No.204 ゴールデン・ウィーク(2)
ユーザー tsuchinaga
提出日時 2019-03-15 14:30:40
言語 Go
(1.23.4)
結果
AC  
実行時間 2 ms / 1,000 ms
コード長 710 bytes
コンパイル時間 11,549 ms
コンパイル使用メモリ 234,744 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-07-01 19:41:42
合計ジャッジ時間 12,814 ms
ジャッジサーバーID
(参考情報)
judge2 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 46
権限があれば一括ダウンロードができます

ソースコード

diff #

package main

import (
	"fmt"
	"math"
)

func main() {
	var d int
	_, _ = fmt.Scan(&d)

	c := make([]int, 14*3)
	for i := 0; i < 2; i++ {
		line := ""
		_, _ = fmt.Scan(&line)
		for j, s := range line {
			if string(s) == "x" {
				c[14+i*7+j] = 0
			} else {
				c[14+i*7+j] = 1
			}
		}
	}

	max := 0
	for i := 0; i < len(c); i++ {
		tmp := make([]int, len(c))
		copy(tmp, c)
		for j := i; j < int(math.Min(float64(i+d), float64(len(c)))); j++ {
			if tmp[j] == 1 {
				break
			}
			tmp[j] = 1
		}
		// fmt.Println(tmp)

		cnt := 0
		for j := 0; j < len(tmp); j++ {
			cnt += tmp[j]
			if tmp[j] == 0 || j == len(tmp)-1 {
				if max < cnt {
					max = cnt
				}
				cnt = 0
			}
		}
	}

	fmt.Println(max)
}
0