結果
問題 | No.447 ゆきこーだーの雨と雪 (2) |
ユーザー |
|
提出日時 | 2016-11-20 03:38:59 |
言語 | PHP (843.2) |
結果 |
WA
(最新)
AC
(最初)
|
実行時間 | - |
コード長 | 1,697 bytes |
コンパイル時間 | 4,369 ms |
コンパイル使用メモリ | 32,020 KB |
実行使用メモリ | 34,900 KB |
最終ジャッジ日時 | 2024-11-27 06:40:11 |
合計ジャッジ時間 | 13,047 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | WA * 3 |
other | WA * 25 |
コンパイルメッセージ
No syntax errors detected in Main.php
ソースコード
<?php // $Tim = microtime(true); ini_set('error_reporting', E_ALL & ~E_NOTICE); ini_set('memory_limit', -1); $ans = array(); $Pcnt = array(); fscanf(STDIN, "%d", $N); $L = explode(" ", trim(fgets(STDIN))); $cntL = count($L); fscanf(STDIN, "%d", $T); for ($i = 0; $i < $T; $i++) { fscanf(STDIN, "%s %s", $Name, $P); $intP = ord($P) - ord('A'); $Pcnt[$intP]++; $score = floor(50 * $L[$intP] + 50 * $L[$intP] / (.8 + .2 * $Pcnt[$intP])); $ans[$Name][$intP] = $score; $ans[$Name]['lastmod'] = $i; $ans[$Name]['score'] += $score; } $board = array(); foreach ($ans as $name => $v) { $base = $ans[$name]; $base['name'] = $name; $board[] = $base; } $people = count($board); for ($i = 0; $i < $people - 1; $i++) { for ($j = $i + 1; $j < $people; $j++) { $swap1 = $board[$i]['score'] < $board[$j]['score']; $swap2a = $board[$i]['score'] == $board[$j]['score']; $swap2b = $board[$i]['lastmod'] > $board[$j]['lastmod']; if ($swap1 || ($swap2a && $swap2b)) { list($board[$i], $board[$j]) = array($board[$j], $board[$i]); } } } $output = ""; for ($i = 0; $i < $people; $i++) { $output .= $i + 1; $output .= " "; $output .= $board[$i]['name']; $output .= " "; for ($j = 0; $j < $cntL; $j++) { $output .= $board[$i][$j] ?: 0; $output .= " "; } $output .= $board[$i]['score']; $output .= PHP_EOL; } echo $output; // echo (microtime(true) - $Tim) . PHP_EOL;