結果

問題 No.1150 シュークリームゲーム(Easy)
ユーザー nikkukunnikkukun
提出日時 2020-08-12 23:19:32
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 1,004 bytes
コンパイル時間 172 ms
コンパイル使用メモリ 82,260 KB
実行使用メモリ 86,656 KB
最終ジャッジ日時 2024-04-18 00:54:45
合計ジャッジ時間 3,649 ms
ジャッジサーバーID
(参考情報)
judge5 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 34 ms
51,840 KB
testcase_01 AC 35 ms
51,840 KB
testcase_02 AC 35 ms
52,096 KB
testcase_03 AC 35 ms
52,608 KB
testcase_04 AC 37 ms
52,224 KB
testcase_05 WA -
testcase_06 AC 35 ms
52,224 KB
testcase_07 WA -
testcase_08 AC 36 ms
52,352 KB
testcase_09 AC 36 ms
52,480 KB
testcase_10 AC 37 ms
52,224 KB
testcase_11 WA -
testcase_12 AC 37 ms
52,736 KB
testcase_13 WA -
testcase_14 AC 36 ms
52,352 KB
testcase_15 WA -
testcase_16 AC 34 ms
51,840 KB
testcase_17 AC 34 ms
51,968 KB
testcase_18 AC 36 ms
51,968 KB
testcase_19 AC 36 ms
52,480 KB
testcase_20 WA -
testcase_21 AC 34 ms
52,736 KB
testcase_22 AC 58 ms
81,664 KB
testcase_23 AC 58 ms
81,536 KB
testcase_24 AC 57 ms
80,256 KB
testcase_25 AC 58 ms
81,920 KB
testcase_26 AC 60 ms
85,120 KB
testcase_27 WA -
testcase_28 AC 63 ms
86,656 KB
testcase_29 AC 59 ms
81,280 KB
testcase_30 AC 59 ms
82,304 KB
testcase_31 AC 59 ms
81,792 KB
testcase_32 AC 60 ms
82,688 KB
testcase_33 WA -
testcase_34 AC 61 ms
85,120 KB
testcase_35 WA -
testcase_36 AC 62 ms
85,888 KB
testcase_37 WA -
testcase_38 AC 57 ms
81,664 KB
testcase_39 WA -
testcase_40 AC 59 ms
83,072 KB
testcase_41 WA -
testcase_42 AC 60 ms
82,304 KB
testcase_43 WA -
testcase_44 AC 63 ms
86,016 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

if __name__ == '__main__':
	n = int(input())
	s, t = map(int, input().split())
	s -= 1
	t -= 1

	a = list(map(int, input().split()))
	a = a[s:] + a[:s]
	s, t = 0, (t - s) % n

	x = t - 1
	y = n - x - 2

	ans = a[s] - a[t]
	if x % 2 == 0 and y % 2 == 0:
		ans += sum(a[1 : 1 + x // 2]) + sum(a[n - y // 2 : n])
		ans -= sum(a[1 + x // 2 : t]) + sum(a[n - y : n - y // 2])
	elif x % 2 == 0 and y % 2 == 1:
		ans += sum(a[1 : 1 + x // 2]) + sum(a[n - y // 2 : n])
		ans -= sum(a[1 + x // 2 : t]) + sum(a[n - y : n - y // 2])
	elif x % 2 == 1 and y % 2 == 0:
		ans += sum(a[1 : 1 + x // 2 + 1]) + sum(a[n - y // 2 : n])
		ans -= sum(a[1 + x // 2 + 1: t]) + sum(a[n - y : n - y // 2])
	else:
		ans1, ans2 = ans, ans
		ans1 += sum(a[1 : 1 + x // 2 + 1]) + sum(a[n - y // 2 : n])
		ans1 -= sum(a[1 + x // 2 + 1: t]) + sum(a[n - y : n - y // 2])
		ans2 += sum(a[1 : 1 + x // 2]) + sum(a[n - y // 2 - 1 : n])
		ans2 -= sum(a[1 + x // 2: t]) + sum(a[n - y : n - y // 2 - 1])
		ans = max(ans1, ans2)
	
	print(ans)

0