QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#369127 | #8247. ICPC Team Generation | mfshi03 | WA | 9ms | 9532kb | Python3 | 429b | 2024-03-27 20:52:19 | 2024-03-27 20:52:21 |
Judging History
answer
def max_teams(n, a, b):
dp = [0] * (n + 1)
dp[n] = 0
for i in range(n - 1, 0, -1):
dp[i] = dp[i + 1]
if i + 2 <= b[i]:
dp[i] = max(dp[i], 1 + dp[min(b[i] + 1, n)])
return dp[1]
# Read input
n = int(input())
a = [0] * (n + 1)
b = [0] * (n + 1)
for i in range(1, n + 1):
a[i], b[i] = map(int, input().split())
# Solve and print output
print(max_teams(n, a, b))
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 9ms
memory: 9532kb
input:
6 1 2 1 2 2 5 2 6 2 6 5 6
output:
1
result:
ok single line: '1'
Test #2:
score: 0
Accepted
time: 9ms
memory: 9444kb
input:
3 1 1 2 2 3 3
output:
0
result:
ok single line: '0'
Test #3:
score: 0
Accepted
time: 9ms
memory: 9444kb
input:
50 1 2 1 3 2 4 3 5 4 6 5 7 6 8 7 9 8 10 9 11 10 12 11 13 12 14 13 15 14 16 15 17 16 18 17 19 18 20 19 21 20 22 21 23 22 24 23 25 24 26 25 27 26 28 27 29 28 30 29 31 30 32 31 33 32 34 33 35 34 36 35 37 36 38 37 39 38 40 39 41 40 42 41 43 42 44 43 45 44 46 45 47 46 48 47 49 48 50 49 50
output:
0
result:
ok single line: '0'
Test #4:
score: -100
Wrong Answer
time: 6ms
memory: 9440kb
input:
50 1 50 1 50 1 50 1 50 1 50 1 50 1 50 1 50 1 50 1 50 1 50 1 50 1 50 1 50 1 50 1 50 1 50 1 50 1 50 1 50 1 50 1 50 1 50 1 50 1 50 1 50 1 50 1 50 1 50 1 50 1 50 1 50 1 50 1 50 1 50 1 50 1 50 1 50 1 50 1 50 1 50 1 50 1 50 1 50 1 50 1 50 1 50 1 50 1 50 1 50
output:
1
result:
wrong answer 1st lines differ - expected: '16', found: '1'