結果

問題 No.1736 Princess vs. Dragoness
ユーザー neko_the_shadowneko_the_shadow
提出日時 2021-11-18 12:14:15
言語 Perl
(5.38.2)
結果
AC  
実行時間 1,201 ms / 2,000 ms
コード長 525 bytes
コンパイル時間 486 ms
コンパイル使用メモリ 5,300 KB
実行使用メモリ 5,808 KB
最終ジャッジ日時 2023-08-26 21:09:33
合計ジャッジ時間 13,402 ms
ジャッジサーバーID
(参考情報)
judge15 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 6 ms
5,216 KB
testcase_01 AC 6 ms
5,284 KB
testcase_02 AC 6 ms
5,304 KB
testcase_03 AC 35 ms
5,368 KB
testcase_04 AC 89 ms
5,460 KB
testcase_05 AC 15 ms
5,400 KB
testcase_06 AC 471 ms
5,432 KB
testcase_07 AC 625 ms
5,624 KB
testcase_08 AC 231 ms
5,468 KB
testcase_09 AC 398 ms
5,568 KB
testcase_10 AC 8 ms
5,364 KB
testcase_11 AC 1,103 ms
5,808 KB
testcase_12 AC 261 ms
5,556 KB
testcase_13 AC 630 ms
5,644 KB
testcase_14 AC 639 ms
5,712 KB
testcase_15 AC 121 ms
5,484 KB
testcase_16 AC 215 ms
5,232 KB
testcase_17 AC 512 ms
5,536 KB
testcase_18 AC 725 ms
5,592 KB
testcase_19 AC 759 ms
5,576 KB
testcase_20 AC 111 ms
5,236 KB
testcase_21 AC 148 ms
5,504 KB
testcase_22 AC 488 ms
5,584 KB
testcase_23 AC 396 ms
5,508 KB
testcase_24 AC 63 ms
5,320 KB
testcase_25 AC 64 ms
5,332 KB
testcase_26 AC 418 ms
5,544 KB
testcase_27 AC 147 ms
5,720 KB
testcase_28 AC 310 ms
5,728 KB
testcase_29 AC 331 ms
5,488 KB
testcase_30 AC 1,201 ms
5,576 KB
testcase_31 AC 125 ms
5,472 KB
testcase_32 AC 408 ms
5,668 KB
testcase_33 AC 6 ms
5,172 KB
testcase_34 AC 7 ms
5,264 KB
testcase_35 AC 6 ms
5,204 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Main.pl syntax OK

ソースコード

diff #

use strict;
use warnings;
use List::Util qw/first max min/;

sub gets {
    chomp(my $line = <>);
    split / /, $line;
}

my ($N, $A, $B, $X, $Y) = gets;
my @H = gets;

while ($A--) {
    my $maxval = max @H;
    my $i = first {$H[$_] == $maxval} (0..$N-1);
    $H[$i] -= $X;
}

while ($B--) {
    my $p = $Y;
    foreach my $i (0..$N-1) {
        next if ($H[$i] <= 0);
        my $d = min($p, $H[$i]);
        $H[$i] -= $d;
        $p -= $d;
    }
}

if (grep {$_ > 0} @H) {
    print "No\n";
} else {
    print "Yes\n";
}
0