結果
問題 | No.2982 Logic Battle |
ユーザー | titia |
提出日時 | 2024-12-07 01:06:30 |
言語 | PyPy3 (7.3.15) |
結果 |
AC
|
実行時間 | 193 ms / 2,000 ms |
コード長 | 1,722 bytes |
コンパイル時間 | 288 ms |
コンパイル使用メモリ | 82,304 KB |
実行使用メモリ | 78,028 KB |
最終ジャッジ日時 | 2024-12-07 01:06:36 |
合計ジャッジ時間 | 6,453 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge5 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 43 ms
52,608 KB |
testcase_01 | AC | 42 ms
52,608 KB |
testcase_02 | AC | 42 ms
52,352 KB |
testcase_03 | AC | 42 ms
52,480 KB |
testcase_04 | AC | 43 ms
52,608 KB |
testcase_05 | AC | 43 ms
52,864 KB |
testcase_06 | AC | 43 ms
52,736 KB |
testcase_07 | AC | 42 ms
52,480 KB |
testcase_08 | AC | 42 ms
52,480 KB |
testcase_09 | AC | 42 ms
52,864 KB |
testcase_10 | AC | 164 ms
77,056 KB |
testcase_11 | AC | 193 ms
77,460 KB |
testcase_12 | AC | 151 ms
76,928 KB |
testcase_13 | AC | 143 ms
77,184 KB |
testcase_14 | AC | 163 ms
77,312 KB |
testcase_15 | AC | 130 ms
76,928 KB |
testcase_16 | AC | 162 ms
77,312 KB |
testcase_17 | AC | 162 ms
77,696 KB |
testcase_18 | AC | 166 ms
77,568 KB |
testcase_19 | AC | 124 ms
77,056 KB |
testcase_20 | AC | 173 ms
77,200 KB |
testcase_21 | AC | 179 ms
78,028 KB |
testcase_22 | AC | 161 ms
77,312 KB |
testcase_23 | AC | 157 ms
77,472 KB |
testcase_24 | AC | 152 ms
77,312 KB |
testcase_25 | AC | 169 ms
77,440 KB |
testcase_26 | AC | 167 ms
77,196 KB |
testcase_27 | AC | 155 ms
76,928 KB |
testcase_28 | AC | 160 ms
77,312 KB |
testcase_29 | AC | 162 ms
77,184 KB |
testcase_30 | AC | 175 ms
77,740 KB |
testcase_31 | AC | 43 ms
52,480 KB |
testcase_32 | AC | 130 ms
76,800 KB |
testcase_33 | AC | 144 ms
77,312 KB |
testcase_34 | AC | 132 ms
77,056 KB |
testcase_35 | AC | 128 ms
77,184 KB |
testcase_36 | AC | 134 ms
77,184 KB |
testcase_37 | AC | 129 ms
76,544 KB |
ソースコード
from operator import itemgetter N=int(input()) DP0=[(0,0)] DP1=[(0,0)] DP2=[(0,0)] for i in range(N): #print(DP0,DP1,DP2) a,b,c=map(int,input().split()) NDP0=[] NDP1=[] NDP2=[] for x,y in DP0: attack=b+x damage=y+attack attack-=1 attack=max(attack,0) NDP1.append((attack,damage)) attack=c+x damage=y+attack attack-=1 attack=max(attack,0) NDP2.append((attack,damage)) for x,y in DP1: attack=a+x damage=y+attack attack-=1 attack=max(attack,0) NDP0.append((attack,damage)) attack=c+x damage=y+attack attack-=1 attack=max(attack,0) NDP2.append((attack,damage)) for x,y in DP2: attack=a+x damage=y+attack attack-=1 attack=max(attack,0) NDP0.append((attack,damage)) attack=b+x damage=y+attack attack-=1 attack=max(attack,0) NDP1.append((attack,damage)) NDP0.sort(key=itemgetter(1),reverse=True) NDP0.sort(key=itemgetter(0),reverse=True) DP0=[] for x,y in NDP0: if DP0 and DP0[-1][1]>=y: continue DP0.append((x,y)) NDP1.sort(key=itemgetter(1),reverse=True) NDP1.sort(key=itemgetter(0),reverse=True) DP1=[] for x,y in NDP1: if DP1 and DP1[-1][1]>=y: continue DP1.append((x,y)) NDP2.sort(key=itemgetter(1),reverse=True) NDP2.sort(key=itemgetter(0),reverse=True) DP2=[] for x,y in NDP2: if DP2 and DP2[-1][1]>=y: continue DP2.append((x,y)) ANS=0 for x,y in DP0+DP1+DP2: ANS=max(ANS,y) print(ANS)