結果
問題 | No.944 煎っぞ! |
ユーザー | calei |
提出日時 | 2020-01-05 22:15:55 |
言語 | Python3 (3.12.2 + numpy 1.26.4 + scipy 1.12.0) |
結果 |
MLE
|
実行時間 | - |
コード長 | 1,244 bytes |
コンパイル時間 | 117 ms |
コンパイル使用メモリ | 12,800 KB |
実行使用メモリ | 819,900 KB |
最終ジャッジ日時 | 2024-05-02 10:33:35 |
合計ジャッジ時間 | 6,428 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge3 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | MLE | - |
testcase_01 | -- | - |
testcase_02 | -- | - |
testcase_03 | -- | - |
testcase_04 | -- | - |
testcase_05 | -- | - |
testcase_06 | -- | - |
testcase_07 | -- | - |
testcase_08 | -- | - |
testcase_09 | -- | - |
testcase_10 | -- | - |
testcase_11 | -- | - |
testcase_12 | -- | - |
testcase_13 | -- | - |
testcase_14 | -- | - |
testcase_15 | -- | - |
testcase_16 | -- | - |
testcase_17 | -- | - |
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 | -- | - |
ソースコード
# 2020/01/05 # 累積和 from itertools import accumulate n=int(input()) a=list(map(int,input().split())) A=list(accumulate(a)) sum_a=A[-1] max_a=max(a) def divisors(n): div=[] for i in range(1,int(n**0.5)+1): if n%i==0: div.append(i) if i!=n//i: div.append(n//i) div.sort(reverse=True) return div class BinarySearch: def __init__(self,arr,key,low,high): import sys sys.setrecursionlimit(10**7) self.arr=arr self.key=key self.low=low self.high=high self.size=len(self.arr) def search(self): mid=(self.high+self.low)//2 if mid>=self.size or self.high<0: return -1 if self.arr[mid]==self.key: return mid if self.high==self.low:return -1 elif self.arr[mid]>self.key: self.high=mid-1 else: self.low=mid+1 return self.search() div=divisors(sum_a) res=[i for i in div if i<=max_a] for r in res: d=sum_a//r for d in range(d,sum_a+1,d): bs=BinarySearch(A,d,0,len(A)) res=bs.search() if res<0:break else: print(r) exit()