Submission #6829582


Source Code Expand

Copy
<?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
Exec Time 347 ms
Memory 13048 KB

Test Cases

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