Submission #5193
Source Code Expand
from __future__ import division, print_function import sys from math import hypot def read_split(): return tuple(map(int, sys.stdin.readline().split())) def shortest(start, goal, cource): L = len(cource) max_left_tilt = min_right_tilt = (goal-start)/L max_left = min_right = L for yy, (left, right) in enumerate(cource, 1): tilt = (left-start) / yy if tilt > max_left_tilt: max_left_tilt = tilt max_left = yy tilt = (right-start) / yy if tilt < min_right_tilt: min_right_tilt = tilt min_right = yy if max_left < L: middle = cource[max_left-1][0] return (shortest(start, middle, cource[:max_left]) + shortest(middle, goal, cource[max_left:])) elif min_right < L: middle = cource[min_right-1][1] return (shortest(start, middle, cource[:min_right]) + shortest(middle, goal, cource[min_right:])) else: return hypot(goal-start, L) def main(): length = int(sys.stdin.readline().strip()) start, goal = read_split() read_split() cource = [read_split() for _ in xrange(length)] cource[-1] = (goal, goal) print(shortest(start, goal, cource)) main()
Submission Info
Submission Time | |
---|---|
Task | D - レースゲーム |
User | methane |
Language | Python (2.7.3) |
Score | 0 |
Code Size | 1304 Byte |
Status | WA |
Exec Time | 2035 ms |
Memory | 50864 KB |
Judge Result
Set Name | all | ||||||
---|---|---|---|---|---|---|---|
Score / Max Score | 0 / 100 | ||||||
Status |
|
Set Name | Test Cases |
---|---|
all | 00_sample1.txt, 00_sample2.txt, 01_rnd_large_00.txt, 01_rnd_large_01.txt, 01_rnd_large_02.txt, 01_rnd_small_00.txt, 01_rnd_small_01.txt, 01_rnd_small_02.txt, 02_narrowrnd_large_00.txt, 02_narrowrnd_large_01.txt, 02_narrowrnd_small_00.txt, 02_narrowrnd_small_01.txt, 03_zigzag_large_00.txt, 03_zigzag_small_00.txt, 04_middle_large_00.txt, 04_middle_large_01.txt, 04_middle_large_02.txt, 04_middle_small_00.txt, 04_middle_small_01.txt, 04_middle_small_02.txt, 05_turnleft_large_00.txt, 05_turnleft_small_00.txt, 06_turnright_large_00.txt, 06_turnright_small_00.txt, 07_free_large_00.txt, 07_free_small_00.txt |
Case Name | Status | Exec Time | Memory |
---|---|---|---|
00_sample1.txt | AC | 48 ms | 128 KB |
00_sample2.txt | AC | 45 ms | 128 KB |
01_rnd_large_00.txt | TLE | 2033 ms | 252 KB |
01_rnd_large_01.txt | TLE | 2034 ms | 44080 KB |
01_rnd_large_02.txt | TLE | 2032 ms | 236 KB |
01_rnd_small_00.txt | AC | 61 ms | 140 KB |
01_rnd_small_01.txt | AC | 58 ms | 144 KB |
01_rnd_small_02.txt | AC | 60 ms | 140 KB |
02_narrowrnd_large_00.txt | TLE | 2032 ms | 47796 KB |
02_narrowrnd_large_01.txt | TLE | 2034 ms | 43568 KB |
02_narrowrnd_small_00.txt | AC | 63 ms | 140 KB |
02_narrowrnd_small_01.txt | AC | 62 ms | 144 KB |
03_zigzag_large_00.txt | TLE | 2033 ms | 248 KB |
03_zigzag_small_00.txt | AC | 168 ms | 136 KB |
04_middle_large_00.txt | TLE | 2033 ms | 252 KB |
04_middle_large_01.txt | TLE | 2032 ms | 228 KB |
04_middle_large_02.txt | TLE | 2033 ms | 228 KB |
04_middle_small_00.txt | AC | 60 ms | 140 KB |
04_middle_small_01.txt | AC | 64 ms | 3520 KB |
04_middle_small_02.txt | AC | 80 ms | 140 KB |
05_turnleft_large_00.txt | TLE | 2035 ms | 50864 KB |
05_turnleft_small_00.txt | AC | 211 ms | 140 KB |
06_turnright_large_00.txt | WA | 1854 ms | 164 KB |
06_turnright_small_00.txt | AC | 50 ms | 132 KB |
07_free_large_00.txt | AC | 773 ms | 164 KB |
07_free_small_00.txt | AC | 50 ms | 132 KB |