結果
問題 | No.1150 シュークリームゲーム(Easy) |
ユーザー | uni_python |
提出日時 | 2020-08-10 00:20:09 |
言語 | PyPy3 (7.3.15) |
結果 |
WA
|
実行時間 | - |
コード長 | 1,308 bytes |
コンパイル時間 | 154 ms |
コンパイル使用メモリ | 82,304 KB |
実行使用メモリ | 91,904 KB |
最終ジャッジ日時 | 2024-04-15 19:48:31 |
合計ジャッジ時間 | 4,301 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge1 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 40 ms
52,224 KB |
testcase_01 | AC | 42 ms
51,840 KB |
testcase_02 | AC | 41 ms
52,096 KB |
testcase_03 | AC | 39 ms
52,352 KB |
testcase_04 | AC | 39 ms
52,224 KB |
testcase_05 | WA | - |
testcase_06 | WA | - |
testcase_07 | WA | - |
testcase_08 | AC | 39 ms
51,840 KB |
testcase_09 | AC | 39 ms
52,224 KB |
testcase_10 | AC | 40 ms
52,096 KB |
testcase_11 | WA | - |
testcase_12 | AC | 39 ms
51,968 KB |
testcase_13 | WA | - |
testcase_14 | WA | - |
testcase_15 | WA | - |
testcase_16 | AC | 40 ms
52,096 KB |
testcase_17 | AC | 40 ms
52,608 KB |
testcase_18 | WA | - |
testcase_19 | WA | - |
testcase_20 | WA | - |
testcase_21 | WA | - |
testcase_22 | AC | 70 ms
80,640 KB |
testcase_23 | WA | - |
testcase_24 | WA | - |
testcase_25 | AC | 74 ms
82,304 KB |
testcase_26 | AC | 73 ms
83,456 KB |
testcase_27 | WA | - |
testcase_28 | AC | 97 ms
90,624 KB |
testcase_29 | AC | 72 ms
82,432 KB |
testcase_30 | WA | - |
testcase_31 | WA | - |
testcase_32 | AC | 92 ms
88,832 KB |
testcase_33 | WA | - |
testcase_34 | AC | 71 ms
83,060 KB |
testcase_35 | WA | - |
testcase_36 | AC | 95 ms
91,904 KB |
testcase_37 | WA | - |
testcase_38 | AC | 67 ms
80,512 KB |
testcase_39 | WA | - |
testcase_40 | AC | 89 ms
88,776 KB |
testcase_41 | WA | - |
testcase_42 | AC | 67 ms
81,400 KB |
testcase_43 | WA | - |
testcase_44 | AC | 70 ms
84,480 KB |
ソースコード
import sys input=sys.stdin.readline def I(): return int(input()) def MI(): return map(int, input().split()) def LI(): return list(map(int, input().split())) def main(): mod=10**9+7 N=I() s,t=MI() s-=1 t-=1 A=LI() S=sum(A) rev=0 if s>t: rev=1 s,t=t,s L1=A[s+1:t] L2=A[t+1:] + A[:s] l1=len(L1) l2=len(L2) X=A[s] for i in range(l1//2): X+=L1[i] for i in range(l2//2): X+=L2[-1-i] if rev: s,t=t,s #距離 def calc(a,b): aa=abs(a-b) bb=N-aa return min(aa,bb) if l1%2==0 and l2%2==0: pass elif l1%2==1 and l2%2==1: #両方奇数なら,sとtから同じ距離の2つのうち,大きい方をとれる temp=[] for i in range(N): ls=calc(i,s) lt=calc(i,t) if ls==lt: temp.append(A[i]) X+=max(temp) else: #片方が奇数なら,sとtから同じ距離のやつをとれる for i in range(N): ls=abs(i-s) lt=abs(i-t) if ls==lt: X+=A[i] break Y=S-X print(X-Y) main()