제출 #1187927

#제출 시각아이디문제언어결과실행 시간메모리
1187927ofozBouquet (EGOI24_bouquet)Pypy 3
0 / 100
3098 ms62700 KiB
from sys import setrecursionlimit, stdout from math import ceil, floor def solve(): n = int(input()) segments = [] for _ in range(n): l, r = map(int, input().split(" ")) segments.append((l, r)) dp = [0] * n for i in range(n): l, r = segments[i] dp[i] = 1 for j in range(0, i-l): l2, r2 = segments[j] if j + r2 < i: # print(i, j) dp[i] = max(dp[i], dp[j] + 1) print(dp[-1]) # let dp[i] be the maximum amount of tulips we can pick up in the i-th point, if we have boundaries l, r. then we can see that dp[i] = max(dp[i-1], dp[j] + 1) # for some j < i such that i-j >= l and i-j >= r_j # so now we just need to find the first tulip j in point 0, i-l such that solve()

컴파일 시 표준 출력 (stdout) 메시지

Compiling 'Main.py'...

=======
  adding: __main__.pyc (deflated 30%)

=======
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...