結果
問題 | No.1150 シュークリームゲーム(Easy) |
ユーザー |
![]() |
提出日時 | 2020-09-05 01:33:49 |
言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
結果 |
AC
|
実行時間 | 109 ms / 2,000 ms |
コード長 | 1,115 bytes |
コンパイル時間 | 98 ms |
コンパイル使用メモリ | 12,672 KB |
実行使用メモリ | 21,904 KB |
最終ジャッジ日時 | 2024-11-26 21:28:03 |
合計ジャッジ時間 | 4,242 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 43 |
ソースコード
def judge(a, b):if b % 2 == 0:if a <= b//2:return 0else:return 100if b % 2 != 0:if a < (b+1)//2:return 0elif a == (b+1)//2:return 1else:return 100def main():N = int(input())s, t = map(int, input().split())A = list(map(int, input().split()))if s > t:s = N+1-st = N+1-tA = A[::-1]R = A[s:t-1]L = A[t:] + A[:s-1]L = L[::-1]len_R = len(R)len_L = len(L)K = (N-1)//2ans = A[s-1]Sum_A = sum(A)R.insert(0, 0)L.insert(0, 0)for i in range(1, len_R+1):R[i] += R[i-1]for i in range(1, len_L+1):L[i] += L[i-1]for i in range(len_R+1):if 0 <= K-i <= len_L:try_max = L[K-i] + R[i] + A[s-1]if try_max > ans:ban = 0ban += judge(K-i, len_L) + judge(i, len_R)if ban <= 1:ans = try_maxres = 2*ans - Sum_Aprint(res)returnif __name__ == "__main__":main()