結果
問題 |
No.447 ゆきこーだーの雨と雪 (2)
|
ユーザー |
|
提出日時 | 2016-11-20 04:18:22 |
言語 | PHP (843.2) |
結果 |
WA
|
実行時間 | - |
コード長 | 1,974 bytes |
コンパイル時間 | 71 ms |
コンパイル使用メモリ | 31,888 KB |
実行使用メモリ | 36,824 KB |
最終ジャッジ日時 | 2024-11-27 06:41:33 |
合計ジャッジ時間 | 4,611 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | WA * 3 |
other | WA * 25 |
コンパイルメッセージ
No syntax errors detected in Main.php
ソースコード
<?php define('DEBUG', true); // define('DEBUG', false); $Tim = microtime(true); $arrTim = array(); 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; } $arrTim[] = microtime(true) - $Tim; $board = array(); foreach ($ans as $name => $v) { $ans[$name]['score2'] = $v['score'] - $v['lastmod'] / 10000; $base = $ans[$name]; $base['name'] = $name; $board[] = $base; } $arrTim[] = microtime(true) - $Tim; $people = count($board); // for ($i = 0; $i < $people - 1; $i++) { // for ($j = $i + 1; $j < $people; $j++) { // if ($board[$i]['score2'] < $board[$j]['score2']) { // list($board[$i], $board[$j]) = array($board[$j], $board[$i]); // } // } // } usort($board, "cmp"); function cmp($a, $b) { return $a['score2'] < $b['score2']; } $arrTim[] = microtime(true) - $Tim; $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; $arrTim[] = microtime(true) - $Tim; if (DEBUG) { echo implode("\n", $arrTim) . PHP_EOL; }