結果
問題 | No.2012 Largest Triangle |
ユーザー | vwxyz |
提出日時 | 2023-08-08 20:20:49 |
言語 | PyPy3 (7.3.15) |
結果 |
TLE
|
実行時間 | - |
コード長 | 1,808 bytes |
コンパイル時間 | 314 ms |
コンパイル使用メモリ | 82,304 KB |
実行使用メモリ | 174,068 KB |
最終ジャッジ日時 | 2024-04-26 12:46:32 |
合計ジャッジ時間 | 8,131 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge3 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 153 ms
96,740 KB |
testcase_01 | AC | 153 ms
89,856 KB |
testcase_02 | AC | 153 ms
89,472 KB |
testcase_03 | AC | 152 ms
89,728 KB |
testcase_04 | AC | 154 ms
89,568 KB |
testcase_05 | AC | 151 ms
89,696 KB |
testcase_06 | AC | 150 ms
89,984 KB |
testcase_07 | AC | 151 ms
89,728 KB |
testcase_08 | AC | 152 ms
89,472 KB |
testcase_09 | AC | 153 ms
89,676 KB |
testcase_10 | AC | 152 ms
89,984 KB |
testcase_11 | AC | 163 ms
90,380 KB |
testcase_12 | AC | 166 ms
90,880 KB |
testcase_13 | AC | 159 ms
90,368 KB |
testcase_14 | AC | 162 ms
90,540 KB |
testcase_15 | AC | 160 ms
90,368 KB |
testcase_16 | TLE | - |
testcase_17 | TLE | - |
testcase_18 | -- | - |
testcase_19 | -- | - |
testcase_20 | -- | - |
testcase_21 | -- | - |
testcase_22 | -- | - |
testcase_23 | -- | - |
testcase_24 | -- | - |
testcase_25 | -- | - |
testcase_26 | -- | - |
testcase_27 | -- | - |
testcase_28 | -- | - |
testcase_29 | -- | - |
testcase_30 | -- | - |
testcase_31 | -- | - |
testcase_32 | -- | - |
testcase_33 | -- | - |
testcase_34 | -- | - |
testcase_35 | -- | - |
testcase_36 | -- | - |
testcase_37 | -- | - |
testcase_38 | -- | - |
testcase_39 | -- | - |
testcase_40 | -- | - |
testcase_41 | -- | - |
ソースコード
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))) if N<=100: ans=max(abs(X[i]*Y[j]-X[j]*Y[i]) for i in range(N) for j in range(i+1,N)) else: 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 for jj in range(j-100,j+101): ans=max(ans,abs(X[idx[i]]*Y[idx[jj]]-X[idx[jj]]*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 for jj in range(j-100,j+101): ans=max(ans,abs(X[idx[i]]*Y[idx[jj]]-X[idx[jj]]*Y[idx[i]])) print(ans)