結果

問題 No.258 回転寿司(2)
ユーザー roiti46roiti46
提出日時 2015-07-31 22:38:50
言語 Python2
(2.7.18)
結果
AC  
実行時間 421 ms / 2,000 ms
コード長 599 bytes
コンパイル時間 69 ms
コンパイル使用メモリ 6,912 KB
実行使用メモリ 11,008 KB
最終ジャッジ日時 2024-04-24 11:02:43
合計ジャッジ時間 12,290 ms
ジャッジサーバーID
(参考情報)
judge2 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 405 ms
10,880 KB
testcase_01 AC 421 ms
11,008 KB
testcase_02 AC 164 ms
8,320 KB
testcase_03 AC 10 ms
6,272 KB
testcase_04 AC 83 ms
7,296 KB
testcase_05 AC 101 ms
7,424 KB
testcase_06 AC 307 ms
9,984 KB
testcase_07 AC 41 ms
6,784 KB
testcase_08 AC 96 ms
7,424 KB
testcase_09 AC 47 ms
6,912 KB
testcase_10 AC 15 ms
6,528 KB
testcase_11 AC 57 ms
7,040 KB
testcase_12 AC 81 ms
7,296 KB
testcase_13 AC 37 ms
6,912 KB
testcase_14 AC 272 ms
9,600 KB
testcase_15 AC 48 ms
6,912 KB
testcase_16 AC 44 ms
6,784 KB
testcase_17 AC 46 ms
6,784 KB
testcase_18 AC 345 ms
10,240 KB
testcase_19 AC 11 ms
6,272 KB
testcase_20 AC 202 ms
8,704 KB
testcase_21 AC 290 ms
9,728 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,272 KB
testcase_26 AC 167 ms
8,192 KB
testcase_27 AC 49 ms
6,912 KB
testcase_28 AC 397 ms
10,880 KB
testcase_29 AC 68 ms
7,168 KB
testcase_30 AC 17 ms
6,528 KB
testcase_31 AC 17 ms
6,400 KB
testcase_32 AC 52 ms
6,912 KB
testcase_33 AC 235 ms
9,088 KB
testcase_34 AC 140 ms
7,936 KB
testcase_35 AC 114 ms
7,680 KB
testcase_36 AC 19 ms
6,400 KB
testcase_37 AC 16 ms
6,400 KB
testcase_38 AC 61 ms
7,040 KB
testcase_39 AC 58 ms
6,912 KB
testcase_40 AC 175 ms
8,192 KB
testcase_41 AC 236 ms
8,960 KB
testcase_42 AC 48 ms
6,784 KB
testcase_43 AC 28 ms
6,528 KB
testcase_44 AC 282 ms
9,600 KB
testcase_45 AC 183 ms
8,704 KB
testcase_46 AC 10 ms
6,272 KB
testcase_47 AC 193 ms
8,576 KB
testcase_48 AC 24 ms
6,528 KB
testcase_49 AC 48 ms
6,912 KB
testcase_50 AC 11 ms
6,272 KB
testcase_51 AC 152 ms
7,936 KB
testcase_52 AC 123 ms
7,808 KB
testcase_53 AC 19 ms
6,400 KB
testcase_54 AC 182 ms
8,448 KB
testcase_55 AC 412 ms
10,624 KB
testcase_56 AC 184 ms
8,576 KB
testcase_57 AC 23 ms
6,528 KB
testcase_58 AC 112 ms
7,680 KB
testcase_59 AC 348 ms
10,112 KB
testcase_60 AC 13 ms
6,400 KB
testcase_61 AC 222 ms
8,960 KB
testcase_62 AC 51 ms
6,912 KB
testcase_63 AC 160 ms
8,320 KB
testcase_64 AC 393 ms
10,880 KB
testcase_65 AC 177 ms
8,448 KB
testcase_66 AC 11 ms
6,272 KB
testcase_67 AC 259 ms
9,344 KB
testcase_68 AC 277 ms
9,600 KB
testcase_69 AC 216 ms
8,960 KB
testcase_70 AC 44 ms
6,784 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import copy
N = int(raw_input())
V = map(int, raw_input().split())

dp = [[[0, []], [0, []]] for i in xrange(N)]
dp[0][0] = [V[0], [1]]
for i in xrange(1, N):
    dp[i][0] = copy.deepcopy(dp[i - 1][1])
    dp[i][0][0] += V[i]
    dp[i][0][1].append(i + 1)

    if dp[i - 1][0][0] >= dp[i - 1][1][0]:
        dp[i][1] = copy.deepcopy(dp[i - 1][0])
    else:
        dp[i][1] = copy.deepcopy(dp[i - 1][1])

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