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 |
1 |
Incorrect |
16 ms |
2900 KB |
It was possible to solve 100 problems and you solved only 0. |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
17 ms |
2900 KB |
It was possible to solve 95 problems and you solved only 5. |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
20 ms |
2844 KB |
It was possible to solve 80 problems and you solved only 0. |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
56 ms |
2876 KB |
It was possible to solve 200 problems and you solved only 0. |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
249 ms |
2900 KB |
It was possible to solve 494 problems and you solved only 5. |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
209 ms |
2900 KB |
It was possible to solve 500 problems and you solved only 0. |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
325 ms |
2900 KB |
It was possible to solve 500 problems and you solved only 0. |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
85 ms |
2912 KB |
It was possible to solve 390 problems and you solved only 11. |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
219 ms |
2900 KB |
It was possible to solve 500 problems and you solved only 0. |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
92 ms |
3012 KB |
It was possible to solve 452 problems and you solved only 42. |
2 |
Halted |
0 ms |
0 KB |
- |