Submission #6829582


Source Code Expand

<?php
fscanf(STDIN, '%d', $n);
$cnt = 0;
$arr = [];
for ($i  = 0; $i < $n; $i++) {
    $s = str_split(trim(fgets(STDIN)));
    $j = $s;
    sort($s);
    $j = implode('', $s);
    if (is_null($arr[$j])) {
        $arr[$j] = 1;
    } else {
        $arr[$j]++;
        if ($arr[$j] === 2 ) {
            $cnt++;
        } elseif ($arr[$j] > 2) {
            $cnt += $arr[$j]*($arr[$j]-1)/2 - ($arr[$j]-1)*($arr[$j]-2)/2;
        }
    }
}
echo $cnt.PHP_EOL;

Submission Info

Submission Time
Task C - Green Bin
User hideyuk1
Language PHP7 (7.0.15)
Score 300
Code Size 476 Byte
Status AC
Exec Time 347 ms
Memory 13048 KiB

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 300 / 300
Status
AC × 3
AC × 13
Set Name Test Cases
Sample a01, a02, a03
All a01, a02, a03, b04, b05, b06, b07, b08, b09, b10, b11, b12, b13
Case Name Status Exec Time Memory
a01 AC 12 ms 4856 KiB
a02 AC 9 ms 4604 KiB
a03 AC 9 ms 4604 KiB
b04 AC 9 ms 4604 KiB
b05 AC 185 ms 4604 KiB
b06 AC 204 ms 4604 KiB
b07 AC 190 ms 4604 KiB
b08 AC 347 ms 13048 KiB
b09 AC 325 ms 13048 KiB
b10 AC 336 ms 13048 KiB
b11 AC 198 ms 4604 KiB
b12 AC 295 ms 13048 KiB
b13 AC 12 ms 4604 KiB