結果

問題 No.1736 Princess vs. Dragoness
ユーザー neko_the_shadowneko_the_shadow
提出日時 2021-11-18 12:15:19
言語 Perl
(5.38.2)
結果
AC  
実行時間 1,167 ms / 2,000 ms
コード長 526 bytes
コンパイル時間 512 ms
コンパイル使用メモリ 5,480 KB
実行使用メモリ 5,936 KB
最終ジャッジ日時 2023-08-26 21:11:03
合計ジャッジ時間 12,631 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 6 ms
5,472 KB
testcase_01 AC 6 ms
5,176 KB
testcase_02 AC 6 ms
5,308 KB
testcase_03 AC 33 ms
5,304 KB
testcase_04 AC 86 ms
5,392 KB
testcase_05 AC 15 ms
5,356 KB
testcase_06 AC 454 ms
5,564 KB
testcase_07 AC 598 ms
5,688 KB
testcase_08 AC 223 ms
5,512 KB
testcase_09 AC 385 ms
5,640 KB
testcase_10 AC 9 ms
5,336 KB
testcase_11 AC 1,074 ms
5,936 KB
testcase_12 AC 258 ms
5,496 KB
testcase_13 AC 591 ms
5,628 KB
testcase_14 AC 619 ms
5,756 KB
testcase_15 AC 115 ms
5,464 KB
testcase_16 AC 213 ms
5,328 KB
testcase_17 AC 493 ms
5,732 KB
testcase_18 AC 680 ms
5,644 KB
testcase_19 AC 719 ms
5,672 KB
testcase_20 AC 107 ms
5,560 KB
testcase_21 AC 144 ms
5,672 KB
testcase_22 AC 481 ms
5,532 KB
testcase_23 AC 388 ms
5,712 KB
testcase_24 AC 63 ms
5,216 KB
testcase_25 AC 62 ms
5,372 KB
testcase_26 AC 408 ms
5,700 KB
testcase_27 AC 141 ms
5,776 KB
testcase_28 AC 306 ms
5,720 KB
testcase_29 AC 315 ms
5,672 KB
testcase_30 AC 1,167 ms
5,512 KB
testcase_31 AC 120 ms
5,436 KB
testcase_32 AC 394 ms
5,528 KB
testcase_33 AC 7 ms
5,356 KB
testcase_34 AC 6 ms
5,204 KB
testcase_35 AC 6 ms
5,260 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 (first {$_ > 0} @H) {
    print "No\n";
} else {
    print "Yes\n";
}
0