====== 퇴사 2 ====== ===== 풀이 ===== * [[ps:problems:boj:14501]]에서 n의 범위를 늘린 버전. 풀이는 그쪽을 참고. ===== 코드 ===== """Solution code for "BOJ 15486. 퇴사 2". - Problem link: https://www.acmicpc.net/problem/15486 - Solution link: http://www.teferi.net/ps/problems/boj/15486 Tags: [DP] """ import sys def main(): N = int(sys.stdin.readline()) dp = [0] * (N + 1) for i in range(N): t_i, p_i = [int(x) for x in sys.stdin.readline().split()] if dp[i] > dp[i + 1]: dp[i + 1] = dp[i] if i + t_i <= N and dp[i] + p_i > dp[i + t_i]: dp[i + t_i] = dp[i] + p_i print(dp[N]) if __name__ == '__main__': main() {{tag>BOJ ps:problems:boj:실버_1}}