結果
問題 | No.250 atetubouのzetubou |
ユーザー | ccppjsrb |
提出日時 | 2020-05-29 17:42:06 |
言語 | Go (1.22.1) |
結果 |
AC
|
実行時間 | 16 ms / 5,000 ms |
コード長 | 2,203 bytes |
コンパイル時間 | 14,261 ms |
コンパイル使用メモリ | 230,048 KB |
実行使用メモリ | 19,584 KB |
最終ジャッジ日時 | 2024-10-15 15:30:14 |
合計ジャッジ時間 | 15,573 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge3 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 13 ms
19,584 KB |
testcase_01 | AC | 11 ms
19,456 KB |
testcase_02 | AC | 15 ms
19,584 KB |
testcase_03 | AC | 16 ms
19,584 KB |
testcase_04 | AC | 14 ms
19,584 KB |
testcase_05 | AC | 15 ms
19,584 KB |
testcase_06 | AC | 14 ms
19,584 KB |
testcase_07 | AC | 13 ms
19,456 KB |
testcase_08 | AC | 15 ms
19,584 KB |
testcase_09 | AC | 13 ms
19,584 KB |
testcase_10 | AC | 15 ms
19,584 KB |
testcase_11 | AC | 14 ms
19,584 KB |
testcase_12 | AC | 15 ms
19,584 KB |
testcase_13 | AC | 13 ms
19,456 KB |
testcase_14 | AC | 10 ms
19,456 KB |
testcase_15 | AC | 15 ms
19,584 KB |
testcase_16 | AC | 15 ms
19,584 KB |
testcase_17 | AC | 15 ms
19,584 KB |
testcase_18 | AC | 15 ms
19,584 KB |
testcase_19 | AC | 16 ms
19,584 KB |
testcase_20 | AC | 10 ms
19,456 KB |
testcase_21 | AC | 10 ms
19,456 KB |
ソースコード
package main import ( "bufio" "fmt" "math" "os" "strconv" ) func getScanner(fp *os.File) *bufio.Scanner { scanner := bufio.NewScanner(fp) scanner.Split(bufio.ScanWords) scanner.Buffer(make([]byte, 1000005), 1000005) return scanner } func getNextString(scanner *bufio.Scanner) string { scanner.Scan() return scanner.Text() } func getNextInt(scanner *bufio.Scanner) int { i, _ := strconv.Atoi(getNextString(scanner)) return i } func getNextInt64(scanner *bufio.Scanner) int64 { i, _ := strconv.ParseInt(getNextString(scanner), 10, 64) return i } func getNextUint64(scanner *bufio.Scanner) uint64 { i, _ := strconv.ParseUint(getNextString(scanner), 10, 64) return i } func getNextFloat64(scanner *bufio.Scanner) float64 { i, _ := strconv.ParseFloat(getNextString(scanner), 64) return i } func main() { fp := os.Stdin wfp := os.Stdout cnt := 0 if os.Getenv("MASPY") == "ますピ" { fp, _ = os.Open(os.Getenv("BEET_THE_HARMONY_OF_PERFECT")) cnt = 1 } if os.Getenv("MASPYPY") == "ますピッピ" { wfp, _ = os.Create(os.Getenv("NGTKANA_IS_GENIUS10")) } scanner := getScanner(fp) writer := bufio.NewWriter(wfp) solve(scanner, writer) for i := 0; i < cnt; i++ { fmt.Fprintln(writer, "-----------------------------------") solve(scanner, writer) } writer.Flush() } func solve(scanner *bufio.Scanner, writer *bufio.Writer) { q := getNextInt(scanner) dp := pre() for i := 0; i < q; i++ { testcase(scanner, writer, dp) } } func testcase(scanner *bufio.Scanner, writer *bufio.Writer, dp [][]int64) { d := getNextInt(scanner) x := getNextInt(scanner) t := getNextInt64(scanner) if dp[d][x] > t { fmt.Fprintln(writer, "ZETUBOU") return } fmt.Fprintln(writer, "AC") } func pre() [][]int64 { dp := makeGrid(1501, 1501) for i := 0; i < 1501; i++ { dp[i][0] = 1 } for i := 1; i < 1501; i++ { for j := 1; j < 1501; j++ { if math.MaxInt64-dp[i][j-1] < dp[i-1][j] { dp[i][j] = math.MaxInt64 continue } dp[i][j] = dp[i][j-1] + dp[i-1][j] } } return dp } func makeGrid(h, w int) [][]int64 { index := make([][]int64, h, h) data := make([]int64, h*w, h*w) for i := 0; i < h; i++ { index[i] = data[i*w : (i+1)*w] } return index }