이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
n, m, r, t, k = map(int, input().split())
problems_solved = [0] * n
time_remaining = [t] * m
contestant_assigned = [-1] * m
starting_time = [-1] * m
for _ in range(k):
a, b = map(int, input().split())
a -= 1 # Adjust index to 0-based
b -= 1 # Adjust index to 0-based
contestant_assigned[b] = a
for problem in range(m - 1, -1, -1):
for contestant in range(n):
if contestant_assigned[problem] == -1 and time_remaining[problem] >= r:
if contestant in range(n) and problem in range(m):
problems_solved[contestant] += 1
time_remaining[problem] -= r
contestant_assigned[problem] = contestant
starting_time[problem] = t - time_remaining[problem]
break
total_penal_points = sum(starting_time)
print(sum(problems_solved), total_penal_points)
for problem in range(m):
if starting_time[problem] != -1:
print(contestant_assigned[problem] + 1, problem + 1, starting_time[problem])
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |