結果
問題 | No.3009 異なる数字の最大の範囲(勉強会用) |
ユーザー | phptaro |
提出日時 | 2015-02-28 15:01:48 |
言語 | PHP (8.3.4) |
結果 |
TLE
|
実行時間 | - |
コード長 | 563 bytes |
コンパイル時間 | 98 ms |
コンパイル使用メモリ | 18,736 KB |
実行使用メモリ | 18,888 KB |
最終ジャッジ日時 | 2023-09-03 16:46:30 |
合計ジャッジ時間 | 7,282 ms |
ジャッジサーバーID (参考情報) |
judge15 / judge14 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 15 ms
18,832 KB |
testcase_01 | AC | 13 ms
18,776 KB |
testcase_02 | AC | 15 ms
18,864 KB |
testcase_03 | AC | 15 ms
18,804 KB |
testcase_04 | AC | 14 ms
18,836 KB |
testcase_05 | AC | 14 ms
18,836 KB |
testcase_06 | AC | 15 ms
18,888 KB |
testcase_07 | AC | 15 ms
18,860 KB |
testcase_08 | AC | 15 ms
18,624 KB |
testcase_09 | AC | 15 ms
18,836 KB |
testcase_10 | AC | 15 ms
18,812 KB |
testcase_11 | AC | 14 ms
18,804 KB |
testcase_12 | AC | 14 ms
18,712 KB |
testcase_13 | AC | 15 ms
18,808 KB |
testcase_14 | AC | 14 ms
18,628 KB |
testcase_15 | TLE | - |
testcase_16 | -- | - |
testcase_17 | -- | - |
testcase_18 | -- | - |
testcase_19 | -- | - |
testcase_20 | -- | - |
testcase_21 | -- | - |
testcase_22 | -- | - |
testcase_23 | -- | - |
testcase_24 | -- | - |
コンパイルメッセージ
No syntax errors detected in Main.php
ソースコード
<?php $num = rtrim(fgets(STDIN), PHP_EOL); $points = trim(fgets(STDIN)); $arr = explode(" ", $points); $ans = array(); for ($j = 0; $j < $num; $j++) { $arr2 = array(); $L = $j; //範囲の始まり for ($k = $j+1; $k < $num; $k++) { $R = $k; //範囲の終わり $range = $R - $L +1; for ($i = $L; $i <= $R; $i++) { $arr2[] = $arr[$i]; } if($range == count(array_unique($arr2))){ $ans[] = $range; //echo "$i $j $k" ."\n"; } } } //var_dump($ans); if(count($ans) == 0){ $answer = 1; }else{ $answer = max($ans); } echo $answer;