結果

問題 No.258 回転寿司(2)
ユーザー yaoshimaxyaoshimax
提出日時 2016-05-08 14:37:45
言語 Python2
(2.7.18)
結果
AC  
実行時間 25 ms / 2,000 ms
コード長 462 bytes
コンパイル時間 47 ms
コンパイル使用メモリ 6,912 KB
実行使用メモリ 11,264 KB
最終ジャッジ日時 2024-04-24 11:18:26
合計ジャッジ時間 3,652 ms
ジャッジサーバーID
(参考情報)
judge2 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 25 ms
11,136 KB
testcase_01 AC 22 ms
11,264 KB
testcase_02 AC 17 ms
8,320 KB
testcase_03 AC 9 ms
6,272 KB
testcase_04 AC 12 ms
7,168 KB
testcase_05 AC 12 ms
7,424 KB
testcase_06 AC 21 ms
9,984 KB
testcase_07 AC 11 ms
6,656 KB
testcase_08 AC 12 ms
7,296 KB
testcase_09 AC 10 ms
6,656 KB
testcase_10 AC 10 ms
6,272 KB
testcase_11 AC 11 ms
6,784 KB
testcase_12 AC 12 ms
7,040 KB
testcase_13 AC 10 ms
6,528 KB
testcase_14 AC 19 ms
9,728 KB
testcase_15 AC 11 ms
6,656 KB
testcase_16 AC 12 ms
6,656 KB
testcase_17 AC 11 ms
6,528 KB
testcase_18 AC 22 ms
10,240 KB
testcase_19 AC 9 ms
6,272 KB
testcase_20 AC 16 ms
8,576 KB
testcase_21 AC 19 ms
9,984 KB
testcase_22 AC 9 ms
6,272 KB
testcase_23 AC 10 ms
6,144 KB
testcase_24 AC 9 ms
6,144 KB
testcase_25 AC 9 ms
6,144 KB
testcase_26 AC 16 ms
8,192 KB
testcase_27 AC 11 ms
6,656 KB
testcase_28 AC 22 ms
11,008 KB
testcase_29 AC 11 ms
6,912 KB
testcase_30 AC 9 ms
6,272 KB
testcase_31 AC 10 ms
6,272 KB
testcase_32 AC 11 ms
6,528 KB
testcase_33 AC 17 ms
9,088 KB
testcase_34 AC 14 ms
7,808 KB
testcase_35 AC 13 ms
7,552 KB
testcase_36 AC 10 ms
6,272 KB
testcase_37 AC 9 ms
6,400 KB
testcase_38 AC 12 ms
7,040 KB
testcase_39 AC 12 ms
6,784 KB
testcase_40 AC 17 ms
8,064 KB
testcase_41 AC 18 ms
8,960 KB
testcase_42 AC 12 ms
6,656 KB
testcase_43 AC 10 ms
6,272 KB
testcase_44 AC 19 ms
9,600 KB
testcase_45 AC 15 ms
8,320 KB
testcase_46 AC 10 ms
6,400 KB
testcase_47 AC 17 ms
8,576 KB
testcase_48 AC 11 ms
6,400 KB
testcase_49 AC 12 ms
6,656 KB
testcase_50 AC 10 ms
6,272 KB
testcase_51 AC 15 ms
7,936 KB
testcase_52 AC 14 ms
7,680 KB
testcase_53 AC 10 ms
6,144 KB
testcase_54 AC 16 ms
8,448 KB
testcase_55 AC 23 ms
11,136 KB
testcase_56 AC 16 ms
8,448 KB
testcase_57 AC 10 ms
6,528 KB
testcase_58 AC 12 ms
7,680 KB
testcase_59 AC 21 ms
10,496 KB
testcase_60 AC 10 ms
6,400 KB
testcase_61 AC 19 ms
8,960 KB
testcase_62 AC 11 ms
6,656 KB
testcase_63 AC 15 ms
8,192 KB
testcase_64 AC 23 ms
11,136 KB
testcase_65 AC 17 ms
8,320 KB
testcase_66 AC 10 ms
6,272 KB
testcase_67 AC 20 ms
9,472 KB
testcase_68 AC 19 ms
9,600 KB
testcase_69 AC 17 ms
8,704 KB
testcase_70 AC 11 ms
6,656 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

N=int(raw_input())
V=map(int,raw_input().split())
dp=[[(0,[]) for i in range(2)] for k in range(N+1)]
for i in range(1,N+1):
    v=V[i-1]
    dp[i][1]=(dp[i-1][0][0]+v,list(dp[i-1][0][1]))
    dp[i][1][1].append(i)

    dp[i][0]=(dp[i-1][0][0],list(dp[i-1][0][1]))
    if dp[i-1][1][0] > dp[i-1][0][0]:
        dp[i][0]=(dp[i-1][1][0],list(dp[i-1][1][1]))

ans = dp[N][0]
if dp[N][1][0]>dp[N][0][0]:
    ans=dp[N][1]
print ans[0]
print " ".join(map(str,ans[1]))
0