結果

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

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 18 ms
8,844 KB
testcase_01 AC 17 ms
8,860 KB
testcase_02 AC 19 ms
8,864 KB
testcase_03 AC 18 ms
8,868 KB
testcase_04 AC 17 ms
8,884 KB
testcase_05 AC 18 ms
8,728 KB
testcase_06 AC 19 ms
8,876 KB
testcase_07 WA -
testcase_08 AC 28 ms
8,728 KB
testcase_09 WA -
testcase_10 AC 97 ms
8,780 KB
testcase_11 AC 347 ms
8,736 KB
testcase_12 AC 916 ms
8,744 KB
testcase_13 WA -
testcase_14 WA -
testcase_15 AC 899 ms
8,920 KB
testcase_16 WA -
testcase_17 WA -
testcase_18 WA -
testcase_19 WA -
権限があれば一括ダウンロードができます

ソースコード

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]
                cur=sum(cross(x1,x2,y1,y2,k) for k in range(n))
                if cur>ans:ans=cur
    print(ans)

main()
0