Maximum-Cup 2013

Submission #3685609

Source codeソースコード

N,NX,NY,QX,QY = map(int,input().split())
src = [tuple(map(int,input().split())) for i in range(N-1)]

def cross_prod(ax,ay,bx,by,px,py):
    v1x = bx - ax
    v1y = by - ay
    v2x = px - ax
    v2y = py - ay
    return v1x * v2y - v1y * v2x

def is_crossing(x11,y11,x12,y12,x21,y21,x22,y22):
    l1_p21 = cross_prod(x11,y11,x12,y12,x21,y21)
    l1_p22 = cross_prod(x11,y11,x12,y12,x22,y22)
    l2_p11 = cross_prod(x21,y21,x22,y22,x11,y11)
    l2_p12 = cross_prod(x21,y21,x22,y22,x12,y12)
    return l1_p21 * l1_p22 < 0 and l2_p11 * l2_p12 < 0

ans = 1
for x1,y1,x2,y2 in src:
    if is_crossing(NX,NY,QX,QY,x1,y1,x2,y2):
        ans += 1
print(ans)

Submission

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

Test case

Set

Set name Score得点 / Max score Cases
All 0 / 100 00-sample,10-parallel,10-retmin,10-touch,50-alignedrand-00,50-alignedrand-01,50-alignedrand-02,50-alignedrand-03,50-alignedrand-04,50-alignedrand-05,50-alignedrand-06,50-alignedrand-07,50-random-00,50-random-01,50-random-02,50-random-03,50-random-04,50-random-05,50-random-06,50-random-07,50-random-08,50-random-09,50-random-10,50-random-11,50-random-12,50-random-13,50-random-14,50-random-15,50-random-16,50-random-17,50-random-18,50-random-19,50-random-20,50-random-21,50-random-22,50-random-23,50-random-24,50-retmax-00,50-retmax-01,50-retmax-02,50-retmin-00,50-retmin-01,50-retmin-02

Test case

Case name Status状態 Exec time実行時間 Memory usageメモリ使用量
00-sample AC 18 ms 3064 KB
10-parallel AC 18 ms 3064 KB
10-retmin AC 18 ms 3064 KB
10-touch WA
50-alignedrand-00 WA
50-alignedrand-01 WA
50-alignedrand-02 WA
50-alignedrand-03 WA
50-alignedrand-04 WA
50-alignedrand-05 WA
50-alignedrand-06 WA
50-alignedrand-07 WA
50-random-00 AC 68 ms 4976 KB
50-random-01 AC 64 ms 4848 KB
50-random-02 AC 59 ms 4592 KB
50-random-03 AC 65 ms 4848 KB
50-random-04 AC 46 ms 4084 KB
50-random-05 AC 52 ms 4340 KB
50-random-06 WA
50-random-07 AC 59 ms 4596 KB
50-random-08 AC 61 ms 4720 KB
50-random-09 AC 63 ms 4852 KB
50-random-10 WA
50-random-11 AC 40 ms 3828 KB
50-random-12 AC 26 ms 3316 KB
50-random-13 WA
50-random-14 WA
50-random-15 AC 24 ms 3188 KB
50-random-16 AC 38 ms 3828 KB
50-random-17 AC 58 ms 4464 KB
50-random-18 WA
50-random-19 WA
50-random-20 WA
50-random-21 WA
50-random-22 WA
50-random-23 AC 20 ms 3064 KB
50-random-24 AC 63 ms 4724 KB
50-retmax-00 WA
50-retmax-01 WA
50-retmax-02 WA
50-retmin-00 AC 38 ms 3828 KB
50-retmin-01 AC 47 ms 4084 KB
50-retmin-02 AC 34 ms 3696 KB