結果
| 問題 |
No.2056 非力なレッド
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2022-10-02 12:36:36 |
| 言語 | Go (1.23.4) |
| 結果 |
AC
|
| 実行時間 | 38 ms / 2,000 ms |
| コード長 | 836 bytes |
| コンパイル時間 | 14,068 ms |
| コンパイル使用メモリ | 230,560 KB |
| 実行使用メモリ | 5,248 KB |
| 最終ジャッジ日時 | 2024-12-24 23:18:55 |
| 合計ジャッジ時間 | 17,405 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 38 |
ソースコード
package main
import (
"bufio"
"fmt"
"os"
"strconv"
)
var sc = bufio.NewScanner(os.Stdin)
var out = bufio.NewWriter(os.Stdout)
func solve(n, x, m int, a []int) string {
var use, magic int
for i := n - 1; i >= 0; i-- {
for a[i]/(1<<magic) >= x {
magic++
use += i + 1
}
}
if use <= m {
return "Yes"
} else {
return "No"
}
}
func main() {
buf := make([]byte, 1024*1024)
sc.Buffer(buf, bufio.MaxScanTokenSize)
sc.Split(bufio.ScanWords)
n, x, m := nextInt(), nextInt(), nextInt()
a := nextIntSlice(n)
ans := solve(n, x, m, a)
PrintString(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 PrintString(x string) {
defer out.Flush()
fmt.Fprintln(out, x)
}