Submission #3685609


Source Code Expand

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 Info

Submission Time
Task C - 白蛇のお守り
User prd_xxx
Language Python (3.4.3)
Score 0
Code Size 670 Byte
Status WA
Exec Time 70 ms
Memory 5108 KB

Judge Result

Set Name All
Score / Max Score 0 / 100
Status
AC × 22
WA × 21
Set Name Test Cases
All 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
Case Name Status Exec Time Memory
00-sample AC 18 ms 3064 KB
10-parallel AC 18 ms 3064 KB
10-retmin AC 18 ms 3064 KB
10-touch WA 18 ms 3064 KB
50-alignedrand-00 WA 67 ms 4976 KB
50-alignedrand-01 WA 30 ms 3444 KB
50-alignedrand-02 WA 65 ms 4848 KB
50-alignedrand-03 WA 36 ms 3696 KB
50-alignedrand-04 WA 40 ms 3824 KB
50-alignedrand-05 WA 31 ms 3444 KB
50-alignedrand-06 WA 47 ms 4212 KB
50-alignedrand-07 WA 67 ms 4848 KB
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 44 ms 3952 KB
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 68 ms 4976 KB
50-random-11 AC 40 ms 3828 KB
50-random-12 AC 26 ms 3316 KB
50-random-13 WA 17 ms 3064 KB
50-random-14 WA 53 ms 4340 KB
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 66 ms 4852 KB
50-random-19 WA 50 ms 4212 KB
50-random-20 WA 69 ms 4976 KB
50-random-21 WA 64 ms 4852 KB
50-random-22 WA 40 ms 3828 KB
50-random-23 AC 20 ms 3064 KB
50-random-24 AC 63 ms 4724 KB
50-retmax-00 WA 70 ms 5108 KB
50-retmax-01 WA 68 ms 5108 KB
50-retmax-02 WA 69 ms 5104 KB
50-retmin-00 AC 38 ms 3828 KB
50-retmin-01 AC 47 ms 4084 KB
50-retmin-02 AC 34 ms 3696 KB