結果
問題 | No.2056 非力なレッド |
ユーザー |
![]() |
提出日時 | 2022-08-26 21:25:13 |
言語 | Java (openjdk 23) |
結果 |
AC
|
実行時間 | 358 ms / 2,000 ms |
コード長 | 866 bytes |
コンパイル時間 | 2,469 ms |
コンパイル使用メモリ | 76,268 KB |
実行使用メモリ | 61,376 KB |
最終ジャッジ日時 | 2024-10-13 21:48:18 |
合計ジャッジ時間 | 12,137 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 38 |
ソースコード
import java.io.BufferedReader;import java.io.InputStreamReader;public class Main {public static void main(String[] args) throws Exception {BufferedReader br = new BufferedReader(new InputStreamReader(System.in));String[] sa = br.readLine().split(" ");int n = Integer.parseInt(sa[0]);int x = Integer.parseInt(sa[1]);int m = Integer.parseInt(sa[2]);sa = br.readLine().split(" ");int[] a = new int[n];for (int i = 0; i < n; i++) {a[i] = Integer.parseInt(sa[i]);}br.close();int[] c = new int[n];for (int i = 0; i < n; i++) {while (a[i] >= x) {a[i] /= 2;c[i]++;}}int b = 0;int max = 0;for (int i = n - 1; i >= 0; i--) {if (c[i] > max) {b += (c[i] - max) * (i + 1);max = c[i];}}if (b <= m) {System.out.println("Yes");} else {System.out.println("No");}}}