It breaks through in 9 and a half minutes. How many times should I apply it in the vertically and horizontally long ones? That's it. Because I misunderstood at first and thought that I would apply it alternately, it took time and the ranking was bottomed out ....
H = int(input())
W = int(input())
N = int(input())
t = max(H, W)
print((N + t - 1) // t)
Break through in 13 minutes. All you have to do is line up K S and N --K that do not add up to S. Each value in the sequence of answers should be 1-10 9 </ sup>. Be careful.
N, K, S = map(int, input().split())
result = [S % 10 ** 9 + 1] * N
for i in range(K):
result[i] = S
print(*result)
Defeated.
Addendum: I dropped the explanation into Python code and AC. The only part that was different from the WA-eaten code I wrote was whether to sort by x or by x + l ...
N = int(input())
XL = [list(map(int, input().split())) for _ in range(N)]
t = [(x + l, x - l) for x, l in XL]
t.sort()
max_r = -float('inf')
result = 0
for i in range(N):
r, l = t[i]
if max_r <= l:
result += 1
max_r = r
print(result)
Recommended Posts