結果

問題 No.2331 Maximum Quadrilateral
ユーザー Navier_BoltzmannNavier_Boltzmann
提出日時 2023-05-31 22:48:13
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 1,171 bytes
コンパイル時間 921 ms
コンパイル使用メモリ 86,932 KB
実行使用メモリ 80,724 KB
最終ジャッジ日時 2023-08-28 01:39:55
合計ジャッジ時間 13,404 ms
ジャッジサーバーID
(参考情報)
judge13 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 457 ms
80,336 KB
testcase_01 AC 333 ms
80,084 KB
testcase_02 WA -
testcase_03 AC 442 ms
80,676 KB
testcase_04 AC 419 ms
80,140 KB
testcase_05 AC 433 ms
80,608 KB
testcase_06 AC 435 ms
80,472 KB
testcase_07 WA -
testcase_08 AC 326 ms
80,300 KB
testcase_09 WA -
testcase_10 AC 299 ms
80,524 KB
testcase_11 AC 314 ms
80,324 KB
testcase_12 AC 347 ms
80,088 KB
testcase_13 WA -
testcase_14 AC 450 ms
80,432 KB
testcase_15 WA -
testcase_16 AC 257 ms
80,416 KB
testcase_17 AC 152 ms
79,984 KB
testcase_18 WA -
testcase_19 AC 154 ms
80,116 KB
testcase_20 AC 486 ms
80,272 KB
testcase_21 WA -
testcase_22 AC 471 ms
80,516 KB
testcase_23 AC 484 ms
80,160 KB
testcase_24 WA -
testcase_25 AC 100 ms
72,848 KB
testcase_26 AC 98 ms
72,920 KB
testcase_27 AC 99 ms
72,844 KB
testcase_28 AC 100 ms
72,848 KB
testcase_29 WA -
testcase_30 WA -
testcase_31 AC 100 ms
72,928 KB
testcase_32 AC 101 ms
72,820 KB
testcase_33 AC 100 ms
72,772 KB
testcase_34 AC 102 ms
72,928 KB
testcase_35 AC 100 ms
72,840 KB
testcase_36 AC 101 ms
72,872 KB
testcase_37 AC 99 ms
72,888 KB
testcase_38 AC 99 ms
72,776 KB
testcase_39 AC 100 ms
72,772 KB
testcase_40 AC 99 ms
73,096 KB
testcase_41 AC 101 ms
72,920 KB
testcase_42 WA -
testcase_43 WA -
testcase_44 WA -
testcase_45 AC 100 ms
72,932 KB
testcase_46 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

from collections import *
from itertools import *
from functools import *
from heapq import *
import sys,math
input = sys.stdin.readline

N = int(input())
XY = [tuple(map(int,input().split())) for _ in range(N)]

ans = -1

def S(X,Y,Z):
    
    dx1,dy1 = Y[0]-X[0],Y[1]-X[1]
    dx2,dy2 = Z[0]-X[0],Z[1]-X[1]
    
    return dx1*dy2-dx2*dy1

INF = (1<<30)
def line(X,Y):
    x1,y1 = X
    x2,y2 = Y
    a = y2-y1
    b = x1-x2
    c = x2*y1 - x1*y2
    g = math.gcd(a,b)
    g = math.gcd(g,c)
    a //= g
    b //= g
    c //= g
    if a<0:
        a *= -1
        b *= -1
        c *= -1
    return (a,b,c)
for i in range(N-1):
    XI = XY[i]
    for j in range(i+1,N):
        XJ = XY[j]
        
        a,b,c = line(XI,XJ)
        m = INF
        M = -INF
        for k in range(N):
            if k==i:
                continue
            if j==i:
                continue
            Xk = XY[k]
            val = a*Xk[0]+b*Xk[1]+c
            if val<m:
                m = val
                XS = Xk
            if val>M:
                M = val
                XT = Xk
                
        tmp = S(XI,XJ,XS)-S(XI,XJ,XT)
        ans = max(ans,tmp)
print(ans)
0