結果

問題 No.1010 折って重ねて
ユーザー c-yan
提出日時 2020-03-20 21:40:50
言語 Go
(1.23.4)
結果
TLE  
実行時間 -
コード長 937 bytes
コンパイル時間 11,597 ms
コンパイル使用メモリ 227,252 KB
実行使用メモリ 810,944 KB
最終ジャッジ日時 2024-12-15 05:14:00
合計ジャッジ時間 20,069 ms
ジャッジサーバーID
(参考情報)
judge4 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 38 WA * 3 TLE * 1 MLE * 1
権限があれば一括ダウンロードができます

ソースコード

diff #

package main

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

type qe struct {
	x, y, h, r int
}

func main() {
	x := readInt()
	y := readInt()
	h := readInt()

	x *= 1000
	y *= 1000

	q := make([]qe, 0)
	q = append(q, qe{x, y, h, 0})

	result := 0
	for len(q) != 0 {
		e := q[0]
		q = q[1:]
		if e.r > result {
			result = e.r
		}
		if e.x > e.h {
			q = append(q, qe{e.x / 2, e.y, e.h * 2, e.r + 1})
		}
		if e.y > e.h {
			q = append(q, qe{e.x, e.y / 2, e.h * 2, e.r + 1})
		}
	}
	fmt.Println(result)
}

const (
	ioBufferSize = 1 * 1024 * 1024 // 1 MB
)

var stdinScanner = func() *bufio.Scanner {
	result := bufio.NewScanner(os.Stdin)
	result.Buffer(make([]byte, ioBufferSize), ioBufferSize)
	result.Split(bufio.ScanWords)
	return result
}()

func readString() string {
	stdinScanner.Scan()
	return stdinScanner.Text()
}

func readInt() int {
	result, err := strconv.Atoi(readString())
	if err != nil {
		panic(err)
	}
	return result
}
0