Submission #1691023
Source Code Expand
<?php fscanf(STDIN, "%d %d", $n, $m); $arr = array(); for ($i = 0; $i < $n; $i++) { fscanf(STDIN, "%d", $arr[$i]); } $totalCountArray = array(); $totalCount = 0; $directSubCount = 0; $favoriteSubCount = 0; for ($i = 0; $i < $m; $i++) { $favoriteNum = $i+1; for ($j = 0; $j < $n-1; $j++) { $original = $arr[$j]; while ($arr[$j] !== $arr[$j+1]) { if ($arr[$j] === $m) { $arr[$j] = 1; } else { $arr[$j]++; } $directSubCount++; } $arr[$j] = $favoriteNum; $favoriteSubCount++; while ($arr[$j] !== $arr[$j+1]) { if ($arr[$j] === $m) { $arr[$j] = 1; } else { $arr[$j]++; } $favoriteSubCount++; } if ($directSubCount < $favoriteSubCount) { $totalCount += $directSubCount; } else { $totalCount += $favoriteSubCount; } $directSubCount = 0; $favoriteSubCount = 0; $arr[$j] = $original; } $totalCountArray[$favoriteNum] = $totalCount; $totalCount = 0; } asort($totalCountArray); echo reset($totalCountArray); // echo key($totalCountArray);
Submission Info
Submission Time | |
---|---|
Task | E - guruguru |
User | sms13242000 |
Language | PHP7 (7.0.15) |
Score | 0 |
Code Size | 1377 Byte |
Status | TLE |
Exec Time | 2104 ms |
Memory | 12792 KB |
Judge Result
Set Name | Sample | All | ||||
---|---|---|---|---|---|---|
Score / Max Score | 0 / 0 | 0 / 700 | ||||
Status |
|
|
Set Name | Test Cases |
---|---|
Sample | sample1.txt, sample2.txt |
All | half0.txt, half1.txt, half2.txt, half3.txt, half4.txt, min_m.txt, min_n.txt, mx0.txt, mx1.txt, mx2.txt, rnd0.txt, rnd1.txt, rnd2.txt, rnd3.txt, rnd4.txt, rnd5.txt, rnd6.txt, rnd7.txt, rnd8.txt, rnd9.txt, sample1.txt, sample2.txt |
Case Name | Status | Exec Time | Memory |
---|---|---|---|
half0.txt | TLE | 2104 ms | 6648 KB |
half1.txt | TLE | 2104 ms | 4604 KB |
half2.txt | TLE | 2104 ms | 8696 KB |
half3.txt | TLE | 2104 ms | 12792 KB |
half4.txt | TLE | 2104 ms | 12792 KB |
min_m.txt | TLE | 2104 ms | 4604 KB |
min_n.txt | TLE | 2104 ms | 4604 KB |
mx0.txt | TLE | 2104 ms | 12792 KB |
mx1.txt | TLE | 2104 ms | 12792 KB |
mx2.txt | TLE | 2104 ms | 12792 KB |
rnd0.txt | TLE | 2104 ms | 4604 KB |
rnd1.txt | TLE | 2104 ms | 4604 KB |
rnd2.txt | TLE | 2104 ms | 4604 KB |
rnd3.txt | TLE | 2104 ms | 4604 KB |
rnd4.txt | TLE | 2104 ms | 12792 KB |
rnd5.txt | TLE | 2104 ms | 4604 KB |
rnd6.txt | TLE | 2104 ms | 4604 KB |
rnd7.txt | TLE | 2104 ms | 4604 KB |
rnd8.txt | TLE | 2104 ms | 4604 KB |
rnd9.txt | TLE | 2104 ms | 4604 KB |
sample1.txt | TLE | 2104 ms | 4604 KB |
sample2.txt | TLE | 2104 ms | 4604 KB |