結果
問題 | No.2009 Drunkers' Contest |
ユーザー |
|
提出日時 | 2022-07-15 21:44:22 |
言語 | PyPy3 (7.3.15) |
結果 |
AC
|
実行時間 | 223 ms / 2,000 ms |
コード長 | 670 bytes |
コンパイル時間 | 166 ms |
コンパイル使用メモリ | 82,176 KB |
実行使用メモリ | 141,484 KB |
最終ジャッジ日時 | 2024-06-27 17:22:45 |
合計ジャッジ時間 | 9,865 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 54 |
ソースコード
import sys,random,bisectfrom collections import deque,defaultdictfrom heapq import heapify,heappop,heappushfrom itertools import permutationsfrom math import log,gcdinput = lambda :sys.stdin.readline().rstrip()mi = lambda :map(int,input().split())li = lambda :list(mi())N = int(input())A = li()B = li()stack = [(A[0],B[0])]for i in range(1,N):a,b = A[i],B[i]while stack:pa,pb = stack[-1]if pa*b >= a*pb:stack.pop()a,b = pa+a,pb+belse:breakstack.append((a,b))res = 0for a,b in stack:if a <= b:res += a + belse:res += 2 * (a*b)**.5print(res)