結果

問題 No.944 煎っぞ!
ユーザー tonnnura172
提出日時 2020-04-02 00:30:48
言語 PyPy3
(7.3.15)
結果
RE  
(最新)
AC  
(最初)
実行時間 -
コード長 1,320 bytes
コンパイル時間 235 ms
コンパイル使用メモリ 82,096 KB
実行使用メモリ 90,404 KB
最終ジャッジ日時 2024-06-27 13:00:14
合計ジャッジ時間 7,150 ms
ジャッジサーバーID
(参考情報)
judge1 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other RE * 35
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import accumulate, permutations, combinations, product
from operator import itemgetter, mul, add
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from bisect import bisect, bisect_left
from fractions import gcd
from heapq import heappush, heappop
from functools import reduce
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
def ZIP(n): return zip(*(MAP() for _ in range(n)))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7

def make_divisors(n):
    divisors = []
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            divisors.append(i)
            if i != n // i:
                divisors.append(n//i)
    divisors.sort(reverse=True)
    return divisors

N = INT()
a = LIST()
sum_a = sum(a)
l = make_divisors(sum_a)
a_acc = list(accumulate(a))
for x in l:  # 最終的にxこになる
	block = sum_a//x
	idx = 0
	while idx != len(a):
		idx = bisect(a_acc, block)
		if a_acc[idx-1] != block:
			break
		else:
			block += sum_a//x
	else:
		ans = x
		break
print(ans)
0