結果
問題 | No.2015 Stair Counter |
ユーザー |
|
提出日時 | 2022-07-23 13:27:01 |
言語 | Go (1.23.4) |
結果 |
AC
|
実行時間 | 17 ms / 2,000 ms |
コード長 | 991 bytes |
コンパイル時間 | 13,738 ms |
コンパイル使用メモリ | 223,564 KB |
実行使用メモリ | 6,016 KB |
最終ジャッジ日時 | 2024-07-05 01:14:47 |
合計ジャッジ時間 | 15,499 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 1 |
other | AC * 25 |
ソースコード
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) } }