Contest Duration: ~ (local time) (150 minutes) Back to Home

Submission #1549406

Source Code Expand

Copy
```def LIS(L):
from bisect import bisect
seq=[]
for i in L:
pos=bisect(seq,i)
if len(seq)<=pos:
seq.append(i)
else:
seq[pos]=i
return len(seq)

import math
x1,y1,x2,y2=map(int,input().split())
N=int(input())
W=abs(x2-x1)
H=abs(y2-y1)
xsgn=2*(x2>x1)-1
ysgn=2*(y2>y1)-1
XY=[]
for i in range(N):
x,y=map(int,input().split())
if (x-x1)*(x-x2)<=0 and (y-y1)*(y-y2)<=0:
XY+=[[xsgn*(x-x1),ysgn*(y-y1)]]
short=20-5*math.pi
long=10*math.pi-20
straight=100*(W+H)

XY.sort()
Y = [y for x,y in XY]

fountain=LIS(Y)

if fountain<min(W,H)+1:
print(straight-short*fountain)
else:
print(straight-short*(fountain-1)+long)```

#### Submission Info

Submission Time 2017-08-28 07:16:18+0900 C - Fountain Walk wkb89_ Python3 (3.4.3) 900 685 Byte AC 1323 ms 40168 KB

#### Judge Result

Set Name Score / Max Score Test Cases
Sample 0 / 0 sample_01.txt, sample_02.txt, sample_03.txt
Case Name Status Exec Time Memory
sample_01.txt 17 ms 3064 KB
sample_02.txt 17 ms 3064 KB
sample_03.txt 17 ms 3064 KB