結果
問題 | No.1150 シュークリームゲーム(Easy) |
ユーザー | NoaSaber |
提出日時 | 2021-04-04 11:04:06 |
言語 | PyPy3 (7.3.13) |
結果 |
WA
|
実行時間 | - |
コード長 | 783 bytes |
コンパイル時間 | 1,011 ms |
コンパイル使用メモリ | 87,080 KB |
実行使用メモリ | 93,820 KB |
最終ジャッジ日時 | 2023-08-27 06:39:04 |
合計ジャッジ時間 | 6,582 ms |
ジャッジサーバーID (参考情報) |
judge13 / judge12 |
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 61 ms
71,144 KB |
testcase_01 | AC | 63 ms
71,280 KB |
testcase_02 | AC | 62 ms
71,056 KB |
testcase_03 | AC | 62 ms
71,116 KB |
testcase_04 | WA | - |
testcase_05 | RE | - |
testcase_06 | WA | - |
testcase_07 | RE | - |
testcase_08 | WA | - |
testcase_09 | AC | 62 ms
71,004 KB |
testcase_10 | WA | - |
testcase_11 | WA | - |
testcase_12 | AC | 66 ms
71,304 KB |
testcase_13 | WA | - |
testcase_14 | AC | 61 ms
71,256 KB |
testcase_15 | WA | - |
testcase_16 | AC | 63 ms
71,336 KB |
testcase_17 | WA | - |
testcase_18 | WA | - |
testcase_19 | AC | 63 ms
71,048 KB |
testcase_20 | WA | - |
testcase_21 | WA | - |
testcase_22 | AC | 107 ms
90,860 KB |
testcase_23 | WA | - |
testcase_24 | WA | - |
testcase_25 | AC | 85 ms
89,416 KB |
testcase_26 | AC | 84 ms
92,416 KB |
testcase_27 | WA | - |
testcase_28 | AC | 84 ms
92,032 KB |
testcase_29 | AC | 85 ms
90,316 KB |
testcase_30 | AC | 89 ms
90,324 KB |
testcase_31 | WA | - |
testcase_32 | WA | - |
testcase_33 | WA | - |
testcase_34 | AC | 85 ms
91,332 KB |
testcase_35 | RE | - |
testcase_36 | AC | 88 ms
92,664 KB |
testcase_37 | WA | - |
testcase_38 | AC | 88 ms
90,440 KB |
testcase_39 | RE | - |
testcase_40 | WA | - |
testcase_41 | WA | - |
testcase_42 | AC | 86 ms
91,564 KB |
testcase_43 | WA | - |
testcase_44 | AC | 91 ms
93,636 KB |
ソースコード
N=int(input()) s,t=map(int,input().split()) s-=1;t-=1 A=list(map(int,input().split())) maxi,mini=max(s,t),min(s,t) q1,q2,tmp=A[mini+1:maxi],A[:mini],A[maxi+1:] q2=q2[::-1]+tmp[::-1] dif=A[s]-A[t] if s<t: pos=True else: pos=False if len(q1)%2==0 and len(q2)%2==0: ptA=sum(q1[:len(q1)//2])+sum(q2[:len(q2)//2]) ptB=sum(q1)+sum(q2)-ptA if pos: print(ptA-ptB+dif) else: print(ptB-ptA+dif) elif len(q1)%2==1 and len(q2)%2==1: ptA=sum(q1[:len(q1)//2+1])+sum(q2[:len(q2)//2]) ptB=sum(q1)+sum(q2)-ptA print(abs(ptA-ptB)+dif) else: ptA=sum(q1[:len(q1)//2])+sum(q2[:len(q2)//2]) if len(q1)%2==1: X=q1[len(q1)//2] else: X=q1[len(q2)//2] if pos: ptA+=X ptB=sum(q1)+sum(q2)-ptA print(ptA-ptB+dif)