AtCoder Grand Contest 019

Submission #1548728

Source codeソースコード

def LIS(L):
  """数列L→最大増加部分列の長さ
  計算量はN^2"""
  res=0
  dp=[1]*N#最後がa[i] となるような最長の増加部分列の長さ
  for i in range(N):
    for j in range(i):
      if L[j]<L[i]:
        dp[i]=max(dp[i],dp[j]+1)
    res=max(res,dp[i])
  return res
 
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)]]
N=len(XY)
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

Task問題 C - Fountain Walk
User nameユーザ名 wakabame
Created time投稿日時
Language言語 Python3 (3.4.3)
Status状態 TLE
Score得点 0
Source lengthソースコード長 822 Byte
File nameファイル名
Exec time実行時間 ms
Memory usageメモリ使用量 -

Test case

Set

Set name Score得点 / Max score Cases
Sample - sample_01.txt,sample_02.txt,sample_03.txt
All 0 / 900 sample_01.txt,sample_02.txt,sample_03.txt,sample_01.txt,sample_02.txt,sample_03.txt,subtask_1_01.txt,subtask_1_02.txt,subtask_1_03.txt,subtask_1_04.txt,subtask_1_05.txt,subtask_1_06.txt,subtask_1_07.txt,subtask_1_08.txt,subtask_1_09.txt,subtask_1_10.txt,subtask_1_11.txt,subtask_1_12.txt,subtask_1_13.txt,subtask_1_14.txt,subtask_1_15.txt,subtask_1_16.txt,subtask_1_17.txt,subtask_1_18.txt,subtask_1_19.txt,subtask_1_20.txt,subtask_1_21.txt,subtask_1_22.txt,subtask_1_23.txt,subtask_1_24.txt,subtask_1_25.txt,subtask_1_26.txt,subtask_1_27.txt,subtask_1_28.txt,subtask_1_29.txt,subtask_1_30.txt,subtask_1_31.txt,subtask_1_32.txt,subtask_1_33.txt,subtask_1_34.txt,subtask_1_35.txt,subtask_1_36.txt,subtask_1_37.txt,subtask_1_38.txt,subtask_1_39.txt,subtask_1_40.txt,subtask_1_41.txt

Test case

Case name Status状態 Exec time実行時間 Memory usageメモリ使用量
sample_01.txt AC 17 ms 3064 KB
sample_02.txt AC 17 ms 3064 KB
sample_03.txt AC 17 ms 3064 KB
subtask_1_01.txt AC 17 ms 3064 KB
subtask_1_02.txt AC 17 ms 3064 KB
subtask_1_03.txt AC 17 ms 3064 KB
subtask_1_04.txt AC 17 ms 3064 KB
subtask_1_05.txt AC 17 ms 3064 KB
subtask_1_06.txt AC 17 ms 3064 KB
subtask_1_07.txt AC 17 ms 3064 KB
subtask_1_08.txt AC 17 ms 3064 KB
subtask_1_09.txt AC 205 ms 3064 KB
subtask_1_10.txt AC 419 ms 3064 KB
subtask_1_11.txt AC 122 ms 3064 KB
subtask_1_12.txt TLE
subtask_1_13.txt AC 464 ms 3064 KB
subtask_1_14.txt AC 221 ms 3064 KB
subtask_1_15.txt AC 116 ms 3064 KB
subtask_1_16.txt TLE
subtask_1_17.txt AC 373 ms 3064 KB
subtask_1_18.txt AC 304 ms 3064 KB
subtask_1_19.txt AC 528 ms 3188 KB
subtask_1_20.txt TLE
subtask_1_21.txt TLE
subtask_1_22.txt TLE
subtask_1_23.txt TLE
subtask_1_24.txt AC 17 ms 3064 KB
subtask_1_25.txt AC 17 ms 3064 KB
subtask_1_26.txt AC 18 ms 3064 KB
subtask_1_27.txt AC 17 ms 3064 KB
subtask_1_28.txt TLE
subtask_1_29.txt TLE
subtask_1_30.txt TLE
subtask_1_31.txt TLE
subtask_1_32.txt TLE
subtask_1_33.txt TLE
subtask_1_34.txt TLE
subtask_1_35.txt TLE
subtask_1_36.txt TLE
subtask_1_37.txt TLE
subtask_1_38.txt TLE
subtask_1_39.txt TLE
subtask_1_40.txt TLE
subtask_1_41.txt TLE