結果

問題 No.11 カードマッチ
ユーザー papinianuspapinianus
提出日時 2016-09-21 09:28:13
言語 PHP
(8.3.4)
結果
AC  
実行時間 41 ms / 5,000 ms
コード長 377 bytes
コンパイル時間 1,080 ms
コンパイル使用メモリ 30,628 KB
実行使用メモリ 31,148 KB
最終ジャッジ日時 2024-04-28 16:41:41
合計ジャッジ時間 2,621 ms
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 40 ms
30,852 KB
testcase_01 AC 40 ms
31,148 KB
testcase_02 AC 40 ms
30,872 KB
testcase_03 AC 40 ms
30,924 KB
testcase_04 AC 41 ms
30,800 KB
testcase_05 AC 40 ms
30,884 KB
testcase_06 AC 40 ms
31,088 KB
testcase_07 AC 41 ms
31,052 KB
testcase_08 AC 40 ms
30,916 KB
testcase_09 AC 41 ms
30,832 KB
testcase_10 AC 41 ms
30,916 KB
testcase_11 AC 41 ms
30,808 KB
testcase_12 AC 41 ms
30,876 KB
testcase_13 AC 41 ms
30,728 KB
testcase_14 AC 40 ms
30,768 KB
testcase_15 AC 41 ms
30,716 KB
testcase_16 AC 41 ms
30,684 KB
testcase_17 AC 41 ms
31,024 KB
testcase_18 AC 41 ms
30,924 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
No syntax errors detected in Main.php

ソースコード

diff #

<?php
$wc = trim(fgets(STDIN));
$hc = trim(fgets(STDIN));
$n = trim(fgets(STDIN));
$ws = [];
$hs = [];
$sum = 0;
for(;$n;$n--)
{
    list($w, $h) = explode(" ", trim(fgets(STDIN)));
    $ws[$w][] = $h;
    $hs[] = $h;
}
foreach($ws as $wnumarr)
{
    $sum += $hc - count(array_unique($wnumarr));
}
$sum += ($wc - count($ws)) * count(array_unique($hs));
echo $sum;
echo PHP_EOL;
0