QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#369124 | #8247. ICPC Team Generation | mfshi03 | WA | 10ms | 9540kb | Python3 | 775b | 2024-03-27 20:50:55 | 2024-03-27 20:50:59 |
Judging History
answer
def max_teams(n, a, b):
teams = 0
taken = [False] * (n + 1)
for i in range(1, n + 1):
if not taken[i]:
for j in range(a[i], min(b[i] + 1, i)):
if not taken[j]:
for k in range(j + 1, min(b[i] + 1, i)):
if not taken[k]:
teams += 1
taken[i] = taken[j] = taken[k] = True
break
else:
continue
break
return teams
# 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: 0ms
memory: 9428kb
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: 2ms
memory: 9424kb
input:
3 1 1 2 2 3 3
output:
0
result:
ok single line: '0'
Test #3:
score: 0
Accepted
time: 9ms
memory: 9428kb
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: 0
Accepted
time: 3ms
memory: 9528kb
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:
16
result:
ok single line: '16'
Test #5:
score: 0
Accepted
time: 0ms
memory: 9436kb
input:
50 1 11 2 11 3 12 3 14 3 15 3 16 7 17 7 17 7 18 8 19 11 21 11 22 11 22 14 23 15 25 16 25 17 25 18 27 18 27 20 29 21 30 22 30 22 33 23 34 24 34 24 34 25 37 28 37 29 38 29 38 31 41 32 41 33 43 33 43 35 44 35 46 36 47 37 47 38 48 39 49 39 50 41 50 42 50 44 50 45 50 45 50 45 50 47 50 48 50 48 50
output:
7
result:
ok single line: '7'
Test #6:
score: 0
Accepted
time: 7ms
memory: 9376kb
input:
50 1 8 2 12 2 13 3 14 3 14 5 16 5 16 6 18 9 18 9 20 9 20 12 21 12 21 12 21 14 24 16 24 17 26 17 26 18 27 20 29 20 30 22 30 22 32 24 32 25 35 25 36 25 36 25 36 26 37 30 38 31 41 32 41 33 41 34 43 35 43 35 44 35 44 37 48 37 49 40 50 41 50 41 50 41 50 42 50 44 50 45 50 47 50 47 50 47 50 49 50
output:
8
result:
ok single line: '8'
Test #7:
score: 0
Accepted
time: 10ms
memory: 9424kb
input:
50 1 7 1 12 3 12 4 14 4 14 4 14 6 14 6 14 8 14 10 18 11 19 12 22 12 22 14 22 14 25 14 26 14 26 16 26 17 29 18 30 18 31 18 32 22 32 23 34 23 35 25 35 26 35 26 37 26 37 30 40 31 40 32 41 33 42 33 44 33 45 33 46 33 47 34 47 39 48 39 50 39 50 39 50 41 50 42 50 45 50 45 50 45 50 45 50 45 50 48 50
output:
12
result:
ok single line: '12'
Test #8:
score: 0
Accepted
time: 0ms
memory: 9540kb
input:
50 1 2 2 6 2 7 4 8 5 12 5 15 6 16 8 16 8 19 8 20 8 20 8 21 13 22 13 24 13 25 13 25 16 25 16 25 16 29 20 29 21 30 22 31 22 33 23 33 24 33 25 33 27 33 27 37 28 38 28 39 30 41 32 42 32 42 34 42 34 42 36 45 37 45 37 47 37 47 40 49 40 50 40 50 43 50 43 50 43 50 46 50 46 50 48 50 49 50 50 50
output:
7
result:
ok single line: '7'
Test #9:
score: 0
Accepted
time: 10ms
memory: 9440kb
input:
50 1 8 1 11 2 13 4 13 5 13 6 15 7 15 8 16 8 17 10 19 10 21 11 22 11 22 11 22 12 25 12 25 16 26 17 28 19 28 20 29 20 30 20 31 23 31 23 31 24 33 25 35 26 37 27 38 28 38 30 40 31 40 31 42 31 43 32 44 32 45 34 45 35 45 35 47 38 49 38 50 38 50 42 50 43 50 44 50 44 50 46 50 47 50 47 50 49 50 50 50
output:
6
result:
ok single line: '6'
Test #10:
score: 0
Accepted
time: 10ms
memory: 9432kb
input:
50 1 6 1 7 1 8 2 8 2 10 3 10 3 12 6 13 9 13 10 14 11 16 12 16 12 17 12 19 12 19 14 19 16 19 16 20 18 24 19 25 20 25 22 25 23 26 23 29 23 29 23 29 26 29 26 33 29 33 30 33 31 36 31 36 32 37 32 37 35 38 35 41 35 41 36 41 37 43 38 45 38 45 42 47 42 48 44 49 45 49 45 50 45 50 47 50 47 50 49 50
output:
10
result:
ok single line: '10'
Test #11:
score: 0
Accepted
time: 10ms
memory: 9428kb
input:
50 1 1 2 2 2 5 2 8 3 10 6 10 7 10 8 12 9 12 10 14 10 15 11 16 11 17 14 18 15 18 15 20 15 22 16 22 17 24 20 24 21 25 22 25 23 26 24 28 24 28 25 30 27 30 27 33 29 34 30 35 31 36 32 36 32 36 34 39 35 39 36 40 37 42 38 42 38 43 38 43 38 44 38 46 41 48 41 49 41 49 44 49 47 50 47 50 48 50 50 50
output:
6
result:
ok single line: '6'
Test #12:
score: -100
Wrong Answer
time: 9ms
memory: 9424kb
input:
50 1 1 1 4 1 7 4 8 5 8 5 10 6 12 6 12 6 12 6 12 6 16 11 17 13 18 13 19 15 19 16 21 17 22 17 22 17 22 17 23 17 23 21 24 23 25 24 26 24 29 24 30 24 30 25 33 25 33 28 33 29 34 29 34 29 34 29 36 32 39 32 40 33 40 33 40 38 44 39 45 39 46 39 47 42 48 43 48 45 48 46 48 46 49 46 49 46 49 50 50
output:
11
result:
wrong answer 1st lines differ - expected: '9', found: '11'