complete 25425.py 29766.py 29767.py 29768.py

This commit is contained in:
2025-03-12 18:03:49 +09:00
parent 8079a4dbb4
commit f09d28243f
4 changed files with 71 additions and 0 deletions

View File

@@ -0,0 +1,24 @@
class RankRange:
def __init__(self, N, M, a, K):
# N: team, M: max person per team, a: remains, K: my team
self.N, self.M, self.a, self.K = N, M, a, K
def solve(self):
worst, best = -1, -1
except_us = self.a - self.K
# worst case 1
if except_us >= self.N - 1:
worst = self.N
else:
worst = except_us + 1
# best case
d, m = divmod(except_us, self.M)
best = d + 1 if m == 0 else d + 2
return worst, best
if __name__ == "__main__":
N, M, a, K = map(int, input().split())
print(*RankRange(N, M, a, K).solve())