結果

問題 No.1679 マスゲーム
ユーザー neko_the_shadowneko_the_shadow
提出日時 2021-10-20 09:56:25
言語 Perl
(5.38.2)
結果
AC  
実行時間 424 ms / 2,000 ms
コード長 341 bytes
コンパイル時間 1,015 ms
コンパイル使用メモリ 6,220 KB
実行使用メモリ 30,312 KB
最終ジャッジ日時 2023-10-20 10:56:00
合計ジャッジ時間 7,029 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 8 ms
6,232 KB
testcase_01 AC 8 ms
6,232 KB
testcase_02 AC 8 ms
6,232 KB
testcase_03 AC 420 ms
30,312 KB
testcase_04 AC 419 ms
30,284 KB
testcase_05 AC 409 ms
30,280 KB
testcase_06 AC 420 ms
30,308 KB
testcase_07 AC 412 ms
30,296 KB
testcase_08 AC 410 ms
30,272 KB
testcase_09 AC 424 ms
30,312 KB
testcase_10 AC 418 ms
30,296 KB
testcase_11 AC 418 ms
30,308 KB
testcase_12 AC 35 ms
8,952 KB
testcase_13 AC 152 ms
17,456 KB
testcase_14 AC 409 ms
30,268 KB
testcase_15 AC 357 ms
27,896 KB
testcase_16 AC 289 ms
25,812 KB
testcase_17 AC 8 ms
6,232 KB
testcase_18 AC 202 ms
6,236 KB
testcase_19 AC 9 ms
6,292 KB
testcase_20 AC 9 ms
6,280 KB
testcase_21 AC 9 ms
6,340 KB
testcase_22 AC 9 ms
6,324 KB
testcase_23 AC 9 ms
6,240 KB
testcase_24 AC 9 ms
6,284 KB
testcase_25 AC 10 ms
6,316 KB
testcase_26 AC 9 ms
6,284 KB
testcase_27 AC 9 ms
6,300 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Main.pl syntax OK

ソースコード

diff #

use strict;
use warnings;
use utf8;

use List::Util qw/reduce/;

sub gets {
    chomp(my $s = <>);
    return $s;
}

my $n = gets;
my %p;
my %q;
for (my $i = 0; $i < $n; $i++) {
    my ($a, $b, $t) = split / /, gets;
    $a==0 ? $p{$b-$t}++ : $q{$b-$t}++; 
}

my $ans = reduce {$q{$b} ? $a+$p{$b}*$q{$b} : $a} 0, keys(%p);
print $ans, "\n";
0