結果

問題 No.2012 Largest Triangle
ユーザー vwxyzvwxyz
提出日時 2022-07-15 22:19:59
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 1,661 bytes
コンパイル時間 434 ms
コンパイル使用メモリ 87,064 KB
実行使用メモリ 184,544 KB
最終ジャッジ日時 2023-09-10 02:36:40
合計ジャッジ時間 60,213 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 269 ms
92,552 KB
testcase_01 AC 268 ms
92,404 KB
testcase_02 AC 268 ms
92,300 KB
testcase_03 AC 264 ms
92,284 KB
testcase_04 AC 269 ms
92,524 KB
testcase_05 AC 267 ms
92,532 KB
testcase_06 WA -
testcase_07 AC 265 ms
92,728 KB
testcase_08 AC 268 ms
92,732 KB
testcase_09 AC 266 ms
92,300 KB
testcase_10 AC 268 ms
92,572 KB
testcase_11 WA -
testcase_12 WA -
testcase_13 AC 271 ms
92,332 KB
testcase_14 WA -
testcase_15 WA -
testcase_16 TLE -
testcase_17 TLE -
testcase_18 TLE -
testcase_19 TLE -
testcase_20 TLE -
testcase_21 TLE -
testcase_22 TLE -
testcase_23 TLE -
testcase_24 TLE -
testcase_25 TLE -
testcase_26 TLE -
testcase_27 WA -
testcase_28 WA -
testcase_29 TLE -
testcase_30 TLE -
testcase_31 TLE -
testcase_32 TLE -
testcase_33 TLE -
testcase_34 TLE -
testcase_35 TLE -
testcase_36 WA -
testcase_37 WA -
testcase_38 WA -
testcase_39 WA -
testcase_40 WA -
testcase_41 AC 483 ms
116,144 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import bisect
import copy
import decimal
import fractions
import heapq
import itertools
import math
import random
import sys
import time
from collections import Counter,deque,defaultdict
from functools import lru_cache,reduce
from heapq import heappush,heappop,heapify,heappushpop,_heappop_max,_heapify_max
def _heappush_max(heap,item):
    heap.append(item)
    heapq._siftdown_max(heap, 0, len(heap)-1)
def _heappushpop_max(heap, item):
    if heap and item < heap[0]:
        item, heap[0] = heap[0], item
        heapq._siftup_max(heap, 0)
    return item
from math import gcd as GCD
read=sys.stdin.read
readline=sys.stdin.readline
readlines=sys.stdin.readlines

class IDX:
    def __init__(self,i):
        self.i=i
    def __lt__(self,other):
        i=self.i
        j=other.i
        return X[i]*Y[j]<X[j]*Y[i]

N=int(readline())
X,Y=[],[]
arg=[]
for _ in range(N):
    x,y=map(int,readline().split())
    X.append(x)
    Y.append(y)
    arg.append(math.degrees(math.atan2(y,x)))
arg+=[c+360 for c in arg]
ans=0
idx=[IDX(i) for i in range(N)]
X*=2
Y*=2
idx.sort(reverse=True)
idx=[ID.i for ID in idx]
idx+=[i+N for i in idx]
j=0
for i in range(N):
    while arg[idx[j]]-arg[idx[i]]<90:
        j+=1
    ans=max(ans,abs(X[idx[i]]*Y[idx[j]]-X[idx[j]]*Y[idx[i]]))
    ans=max(ans,abs(X[idx[i]]*Y[idx[j-1]]-X[idx[j-1]]*Y[idx[i]]))
idx=[IDX(i) for i in range(N)]
X*=2
Y*=2
idx.sort(reverse=False)
idx=[ID.i for ID in idx]
idx+=[i+N for i in idx]
j=0
for i in range(N):
    while arg[idx[j]]-arg[idx[i]]<90:
        j+=1
    ans=max(ans,abs(X[idx[i]]*Y[idx[j]]-X[idx[j]]*Y[idx[i]]))
    ans=max(ans,abs(X[idx[i]]*Y[idx[j-1]]-X[idx[j-1]]*Y[idx[i]]))
print(ans)
0