結果

問題 No.258 回転寿司(2)
ユーザー nebukuro09nebukuro09
提出日時 2016-09-28 16:50:17
言語 Python2
(2.7.18)
結果
AC  
実行時間 362 ms / 2,000 ms
コード長 305 bytes
コンパイル時間 122 ms
コンパイル使用メモリ 7,040 KB
実行使用メモリ 8,960 KB
最終ジャッジ日時 2024-04-24 11:23:49
合計ジャッジ時間 10,490 ms
ジャッジサーバーID
(参考情報)
judge4 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 360 ms
8,832 KB
testcase_01 AC 362 ms
8,960 KB
testcase_02 AC 132 ms
7,424 KB
testcase_03 AC 10 ms
6,272 KB
testcase_04 AC 61 ms
6,784 KB
testcase_05 AC 70 ms
6,656 KB
testcase_06 AC 264 ms
8,192 KB
testcase_07 AC 29 ms
6,400 KB
testcase_08 AC 70 ms
6,784 KB
testcase_09 AC 35 ms
6,656 KB
testcase_10 AC 13 ms
6,272 KB
testcase_11 AC 43 ms
6,528 KB
testcase_12 AC 59 ms
6,656 KB
testcase_13 AC 27 ms
6,528 KB
testcase_14 AC 228 ms
7,936 KB
testcase_15 AC 31 ms
6,656 KB
testcase_16 AC 30 ms
6,400 KB
testcase_17 AC 29 ms
6,528 KB
testcase_18 AC 287 ms
8,448 KB
testcase_19 AC 9 ms
6,400 KB
testcase_20 AC 155 ms
7,424 KB
testcase_21 AC 243 ms
8,064 KB
testcase_22 AC 10 ms
6,272 KB
testcase_23 AC 10 ms
6,272 KB
testcase_24 AC 9 ms
6,272 KB
testcase_25 AC 10 ms
6,400 KB
testcase_26 AC 129 ms
7,424 KB
testcase_27 AC 34 ms
6,528 KB
testcase_28 AC 360 ms
8,960 KB
testcase_29 AC 47 ms
6,784 KB
testcase_30 AC 13 ms
6,272 KB
testcase_31 AC 13 ms
6,272 KB
testcase_32 AC 34 ms
6,656 KB
testcase_33 AC 186 ms
7,808 KB
testcase_34 AC 101 ms
7,168 KB
testcase_35 AC 81 ms
7,040 KB
testcase_36 AC 14 ms
6,272 KB
testcase_37 AC 12 ms
6,400 KB
testcase_38 AC 42 ms
6,528 KB
testcase_39 AC 40 ms
6,528 KB
testcase_40 AC 131 ms
7,424 KB
testcase_41 AC 194 ms
7,808 KB
testcase_42 AC 32 ms
6,528 KB
testcase_43 AC 20 ms
6,528 KB
testcase_44 AC 239 ms
8,064 KB
testcase_45 AC 143 ms
7,424 KB
testcase_46 AC 10 ms
6,272 KB
testcase_47 AC 151 ms
7,552 KB
testcase_48 AC 18 ms
6,400 KB
testcase_49 AC 33 ms
6,528 KB
testcase_50 AC 11 ms
6,400 KB
testcase_51 AC 107 ms
7,168 KB
testcase_52 AC 83 ms
6,912 KB
testcase_53 AC 14 ms
6,272 KB
testcase_54 AC 139 ms
7,552 KB
testcase_55 AC 356 ms
8,960 KB
testcase_56 AC 146 ms
7,424 KB
testcase_57 AC 17 ms
6,400 KB
testcase_58 AC 83 ms
6,912 KB
testcase_59 AC 305 ms
8,576 KB
testcase_60 AC 12 ms
6,272 KB
testcase_61 AC 186 ms
7,808 KB
testcase_62 AC 37 ms
6,656 KB
testcase_63 AC 121 ms
7,296 KB
testcase_64 AC 348 ms
8,832 KB
testcase_65 AC 133 ms
7,296 KB
testcase_66 AC 10 ms
6,144 KB
testcase_67 AC 212 ms
7,936 KB
testcase_68 AC 225 ms
8,064 KB
testcase_69 AC 164 ms
7,680 KB
testcase_70 AC 29 ms
6,400 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

N = input()
V = map(int,raw_input().split())
dp = [(V[i], [i]) for i in xrange(N)]

for i in xrange(N):
    for j in xrange(i-1):
        if dp[i][0] < dp[j][0]+V[i]:
            dp[i] = (dp[j][0]+V[i], dp[j][1]+[i])

m = max(dp, key=lambda x:x[0])
print m[0]
print ' '.join(map(lambda y:str(y+1), m[1]))
0