QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#369127#8247. ICPC Team Generationmfshi03WA 9ms9532kbPython3429b2024-03-27 20:52:192024-03-27 20:52:21

Judging History

你现在查看的是最新测评结果

  • [2024-03-27 20:52:21]
  • 评测
  • 测评结果:WA
  • 用时:9ms
  • 内存:9532kb
  • [2024-03-27 20:52:19]
  • 提交

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'