結果

問題 No.1389 Clumsy Calculation
ユーザー 👑 terry_u16terry_u16
提出日時 2021-02-12 21:58:30
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 127 ms / 2,000 ms
コード長 450 bytes
コンパイル時間 351 ms
コンパイル使用メモリ 87,064 KB
実行使用メモリ 111,288 KB
最終ジャッジ日時 2023-09-27 03:55:08
合計ジャッジ時間 4,814 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 66 ms
71,404 KB
testcase_01 AC 70 ms
71,476 KB
testcase_02 AC 65 ms
71,460 KB
testcase_03 AC 72 ms
76,388 KB
testcase_04 AC 73 ms
76,360 KB
testcase_05 AC 76 ms
76,620 KB
testcase_06 AC 75 ms
76,832 KB
testcase_07 AC 75 ms
76,848 KB
testcase_08 AC 66 ms
71,300 KB
testcase_09 AC 123 ms
103,072 KB
testcase_10 AC 107 ms
108,120 KB
testcase_11 AC 76 ms
76,596 KB
testcase_12 AC 75 ms
76,768 KB
testcase_13 AC 72 ms
76,388 KB
testcase_14 AC 119 ms
111,172 KB
testcase_15 AC 118 ms
111,288 KB
testcase_16 AC 118 ms
111,224 KB
testcase_17 AC 123 ms
103,688 KB
testcase_18 AC 124 ms
103,572 KB
testcase_19 AC 125 ms
103,488 KB
testcase_20 AC 125 ms
103,544 KB
testcase_21 AC 126 ms
103,408 KB
testcase_22 AC 125 ms
103,628 KB
testcase_23 AC 127 ms
103,612 KB
testcase_24 AC 124 ms
103,600 KB
testcase_25 AC 126 ms
103,412 KB
testcase_26 AC 118 ms
110,788 KB
testcase_27 AC 118 ms
111,216 KB
testcase_28 AC 126 ms
103,420 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

n, x = map(int, input().split())
s = list(map(int, input().split()))

fromLeft = [0] * (n + 1)
fromRight = [0] * (n + 1)

for i in range(len(s)):
    fromLeft[i + 1] = fromLeft[i] + s[i]

for i in reversed(range(len(s))):
    fromRight[i] = fromRight[i + 1] + s[i]

for i in range(len(s)):
    if s[i] % 2 != 0:
        continue
    half = s[i] // 2
    
    if fromLeft[i] + fromRight[i + 1] + half == (n - 1) * x:
        print(half)
        exit()
0