結果

問題 No.2015 Stair Counter
ユーザー HimaHima
提出日時 2022-07-23 13:27:01
言語 Go
(1.22.1)
結果
AC  
実行時間 17 ms / 2,000 ms
コード長 991 bytes
コンパイル時間 13,863 ms
コンパイル使用メモリ 208,980 KB
実行使用メモリ 8,004 KB
最終ジャッジ日時 2023-09-18 09:30:54
合計ジャッジ時間 16,499 ms
ジャッジサーバーID
(参考情報)
judge11 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,376 KB
testcase_01 AC 12 ms
7,724 KB
testcase_02 AC 13 ms
7,972 KB
testcase_03 AC 13 ms
7,972 KB
testcase_04 AC 11 ms
5,672 KB
testcase_05 AC 10 ms
5,680 KB
testcase_06 AC 15 ms
7,988 KB
testcase_07 AC 16 ms
7,984 KB
testcase_08 AC 14 ms
7,988 KB
testcase_09 AC 7 ms
5,556 KB
testcase_10 AC 8 ms
5,568 KB
testcase_11 AC 9 ms
5,596 KB
testcase_12 AC 8 ms
5,496 KB
testcase_13 AC 8 ms
5,492 KB
testcase_14 AC 9 ms
5,480 KB
testcase_15 AC 10 ms
5,484 KB
testcase_16 AC 16 ms
7,548 KB
testcase_17 AC 8 ms
5,492 KB
testcase_18 AC 14 ms
5,492 KB
testcase_19 AC 17 ms
7,556 KB
testcase_20 AC 10 ms
7,556 KB
testcase_21 AC 10 ms
5,672 KB
testcase_22 AC 13 ms
7,964 KB
testcase_23 AC 14 ms
8,004 KB
testcase_24 AC 11 ms
5,652 KB
testcase_25 AC 11 ms
5,668 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

package main

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

const Mod = 1000000007

var sc = bufio.NewScanner(os.Stdin)
var out = bufio.NewWriter(os.Stdout)

func main() {
	buf := make([]byte, 1024*1024)
	sc.Buffer(buf, bufio.MaxScanTokenSize)
	sc.Split(bufio.ScanWords)

	t := nextInt()
	var n, m []int
	a := make([][]int, t)
	for i := 0; i < t; i++ {
		n = append(n, nextInt())
		m = append(m, nextInt())
		a[i] = append(a[i], nextIntSlice(n[i])...)
	}
	var ans []string
	for i := 0; i < t; i++ {
		ok := true
		for j := 1; j < n[i] && ok; j++ {
			ok = ok && a[i][j-1]+a[i][j] >= m[i]
		}
		if ok {
			ans = append(ans, "Yes")
		} else {
			ans = append(ans, "No")
		}
	}
	PrintVertically(ans)
}

func nextInt() int {
	sc.Scan()
	i, _ := strconv.Atoi(sc.Text())
	return i
}

func nextIntSlice(n int) []int {
	s := make([]int, n)
	for i := range s {
		s[i] = nextInt()
	}
	return s
}

func PrintVertically(x []string) {
	defer out.Flush()
	for _, v := range x {
		fmt.Fprintln(out, v)
	}
}
0