結果

問題 No.1925 悪鬼三七次元
ユーザー tassei903tassei903
提出日時 2022-04-30 20:50:20
言語 PyPy3
(7.3.15)
結果
TLE  
(最新)
AC  
(最初)
実行時間 -
コード長 1,002 bytes
コンパイル時間 245 ms
コンパイル使用メモリ 82,168 KB
実行使用メモリ 112,260 KB
最終ジャッジ日時 2024-04-20 23:29:59
合計ジャッジ時間 47,067 ms
ジャッジサーバーID
(参考情報)
judge4 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 TLE -
testcase_01 TLE -
testcase_02 TLE -
testcase_03 AC 971 ms
96,384 KB
testcase_04 AC 995 ms
96,692 KB
testcase_05 AC 974 ms
96,512 KB
testcase_06 AC 1,002 ms
97,008 KB
testcase_07 AC 988 ms
96,512 KB
testcase_08 AC 967 ms
96,512 KB
testcase_09 AC 1,007 ms
96,384 KB
testcase_10 AC 994 ms
96,764 KB
testcase_11 AC 987 ms
96,868 KB
testcase_12 AC 979 ms
96,744 KB
testcase_13 AC 986 ms
96,868 KB
testcase_14 AC 972 ms
96,692 KB
testcase_15 AC 989 ms
96,512 KB
testcase_16 AC 986 ms
96,512 KB
testcase_17 AC 1,029 ms
96,512 KB
testcase_18 AC 1,000 ms
96,384 KB
testcase_19 AC 986 ms
96,896 KB
testcase_20 AC 1,012 ms
96,768 KB
testcase_21 AC 995 ms
97,152 KB
testcase_22 AC 982 ms
96,904 KB
testcase_23 AC 1,569 ms
102,320 KB
testcase_24 AC 1,172 ms
95,836 KB
testcase_25 AC 281 ms
78,208 KB
testcase_26 AC 158 ms
75,904 KB
testcase_27 AC 761 ms
88,576 KB
testcase_28 AC 905 ms
91,264 KB
testcase_29 AC 368 ms
80,996 KB
testcase_30 AC 1,291 ms
98,556 KB
testcase_31 AC 599 ms
87,208 KB
testcase_32 AC 279 ms
78,320 KB
testcase_33 AC 321 ms
79,744 KB
testcase_34 AC 1,111 ms
95,388 KB
testcase_35 AC 965 ms
92,672 KB
testcase_36 AC 289 ms
79,012 KB
testcase_37 AC 479 ms
83,840 KB
testcase_38 AC 533 ms
84,192 KB
testcase_39 AC 1,665 ms
104,576 KB
testcase_40 AC 719 ms
91,520 KB
testcase_41 AC 535 ms
85,464 KB
testcase_42 AC 1,333 ms
99,400 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
input = lambda :sys.stdin.readline()[:-1]
ni = lambda :int(input())
na = lambda :list(map(int,input().split()))
yes = lambda :print("yes");Yes = lambda :print("Yes");YES = lambda : print("YES")
no = lambda :print("no");No = lambda :print("No");NO = lambda : print("NO")
#######################################################################

from bisect import bisect_left as bl
def g(d):
    if n % 2:
        dp = [0]*(2+n)
        for i in range(n,-1,-1):
            dp[i] = dp[bl(x,x[i]+d)] + bl(x,x[i]+d)-i-1
        #print(dp)
        if dp[0] <= n//2:
            return 1
        else:
            return 0
    else:
        z = 0
        for i in range(n):
            z = max(z, bl(x, x[i]+d)-i-1)
        #print(z)
        if z > n//2:
            return 0
        else:
            return 1

n = ni()
a = na()
x = [0]
for i in range(n):
    x.append(x[-1]+a[i])
ok = 0
ng = 10**14+1
while ng-ok>1:
    d = ok+ng>>1
    if g(d):
        ok= d
    else:
        ng = d
print(ok)
0