結果

問題 No.2331 Maximum Quadrilateral
ユーザー sepa38sepa38
提出日時 2023-04-22 19:36:26
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 415 ms / 2,000 ms
コード長 781 bytes
コンパイル時間 300 ms
コンパイル使用メモリ 82,304 KB
実行使用メモリ 76,800 KB
最終ジャッジ日時 2024-04-24 22:19:18
合計ジャッジ時間 9,414 ms
ジャッジサーバーID
(参考情報)
judge2 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 325 ms
76,544 KB
testcase_01 AC 230 ms
76,544 KB
testcase_02 AC 260 ms
76,800 KB
testcase_03 AC 415 ms
76,544 KB
testcase_04 AC 296 ms
76,544 KB
testcase_05 AC 312 ms
76,416 KB
testcase_06 AC 300 ms
76,288 KB
testcase_07 AC 277 ms
76,416 KB
testcase_08 AC 229 ms
76,416 KB
testcase_09 AC 215 ms
76,544 KB
testcase_10 AC 215 ms
76,416 KB
testcase_11 AC 217 ms
76,416 KB
testcase_12 AC 203 ms
76,416 KB
testcase_13 AC 214 ms
76,160 KB
testcase_14 AC 323 ms
76,416 KB
testcase_15 AC 109 ms
76,160 KB
testcase_16 AC 173 ms
76,416 KB
testcase_17 AC 88 ms
73,856 KB
testcase_18 AC 116 ms
76,032 KB
testcase_19 AC 88 ms
73,216 KB
testcase_20 AC 348 ms
76,288 KB
testcase_21 AC 342 ms
76,544 KB
testcase_22 AC 356 ms
76,288 KB
testcase_23 AC 357 ms
76,160 KB
testcase_24 AC 344 ms
76,160 KB
testcase_25 AC 43 ms
51,968 KB
testcase_26 AC 46 ms
52,736 KB
testcase_27 AC 43 ms
52,736 KB
testcase_28 AC 46 ms
52,480 KB
testcase_29 AC 43 ms
52,608 KB
testcase_30 AC 46 ms
52,480 KB
testcase_31 AC 46 ms
52,096 KB
testcase_32 AC 45 ms
52,736 KB
testcase_33 AC 44 ms
52,864 KB
testcase_34 AC 41 ms
52,224 KB
testcase_35 AC 40 ms
52,480 KB
testcase_36 AC 40 ms
52,608 KB
testcase_37 AC 44 ms
52,480 KB
testcase_38 AC 40 ms
52,608 KB
testcase_39 AC 40 ms
52,352 KB
testcase_40 AC 41 ms
52,352 KB
testcase_41 AC 42 ms
52,736 KB
testcase_42 AC 42 ms
52,352 KB
testcase_43 AC 41 ms
52,352 KB
testcase_44 AC 42 ms
52,352 KB
testcase_45 AC 41 ms
52,096 KB
testcase_46 AC 42 ms
52,608 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

# maximum-quadrilateral

def solve(n, points):
  ans = 0
  for i in range(n):
    for j in range(i+1, n):
      x1, y1 = points[i]
      x2, y2 = points[j]
      di = (x2 - x1) ** 2 + (y2 - y1) ** 2
      a = y1 - y2
      b = x2 - x1
      c = x1 * y2 - x2 * y1
      max_u = 0
      max_d = 0
      for k in range(n):
        x, y = points[k]
        max_u = max(max_u, a*x+b*y+c)
        max_d = min(max_d, a*x+b*y+c)
      if max_u == 0 or max_d == 0:
        continue
      s_u = (max_u ** 2) * di // (a ** 2 + b ** 2)
      s_u = round(s_u ** 0.5)
      s_d = (max_d ** 2) * di // (a ** 2 + b ** 2)
      s_d = round(s_d ** 0.5)
      ans = max(ans, s_u+s_d)
  return ans


n = int(input())
points = [list(map(int, input().split())) for _ in range(n)]
print(solve(n, points))
0