結果

問題 No.245 貫け!
ユーザー mkawa2mkawa2
提出日時 2020-01-30 16:49:57
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
WA  
実行時間 -
コード長 1,412 bytes
コンパイル時間 77 ms
コンパイル使用メモリ 11,040 KB
実行使用メモリ 8,892 KB
最終ジャッジ日時 2023-10-14 08:31:17
合計ジャッジ時間 10,230 ms
ジャッジサーバーID
(参考情報)
judge15 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 24 ms
8,816 KB
testcase_01 AC 23 ms
8,700 KB
testcase_02 AC 21 ms
8,704 KB
testcase_03 AC 21 ms
8,772 KB
testcase_04 AC 21 ms
8,748 KB
testcase_05 AC 21 ms
8,696 KB
testcase_06 AC 21 ms
8,844 KB
testcase_07 WA -
testcase_08 AC 30 ms
8,724 KB
testcase_09 AC 78 ms
8,892 KB
testcase_10 AC 106 ms
8,832 KB
testcase_11 AC 369 ms
8,720 KB
testcase_12 AC 982 ms
8,864 KB
testcase_13 AC 969 ms
8,864 KB
testcase_14 AC 970 ms
8,860 KB
testcase_15 AC 985 ms
8,688 KB
testcase_16 AC 979 ms
8,792 KB
testcase_17 AC 975 ms
8,720 KB
testcase_18 AC 972 ms
8,872 KB
testcase_19 AC 976 ms
8,876 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys

sys.setrecursionlimit(10 ** 6)
from bisect import *
from collections import *
from heapq import *

int1 = lambda x: int(x) - 1
p2D = lambda x: print(*x, sep="\n")
def II(): return int(sys.stdin.readline())
def SI(): return sys.stdin.readline()[:-1]
def MI(): return map(int, sys.stdin.readline().split())
def MI1(): return map(int1, sys.stdin.readline().split())
def MF(): return map(float, sys.stdin.readline().split())
def LI(): return list(map(int, sys.stdin.readline().split()))
def LI1(): return list(map(int1, sys.stdin.readline().split()))
def LF(): return list(map(float, sys.stdin.readline().split()))
def LLI(rows_number): return [LI() for _ in range(rows_number)]
dij = [(0, 1), (1, 0), (0, -1), (-1, 0)]

def main():
    def cross(x1,x2,y1,y2,k):
        vx,vy=x2-x1,y2-y1
        x3,y3,x4,y4=lines[k]
        vx3,vy3=x3-x1,y3-y1
        vx4,vy4=x4-x1,y4-y1
        if (vx*vy3-vy*vx3)*(vx*vy4-vy*vx4)>0:return 0
        else:return 1

    n=II()
    lines=[LI() for _ in range(n)]
    ans=0
    for i in range(n-1):
        l1=lines[i]
        for j in range(i+1,n):
            l2=lines[j]
            for p,q in [(0,0),(0,1),(1,0),(1,1)]:
                x1,y1=l1[p*2],l1[p*2+1]
                x2,y2=l2[q*2],l2[q*2+1]
                if (x1,y1)==(x2,y2):continue
                cur=sum(cross(x1,x2,y1,y2,k) for k in range(n))
                if cur>ans:ans=cur
    print(ans)

main()
0