It broke through in two and a half minutes. I just wrote it, but the code test was clogged and it took me a long time to test it locally in a hurry.
S, W = map(int, input().split())
if W >= S:
print('unsafe')
else:
print('safe')
It breaks through in two and a half minutes. Since it is a B problem, it does not TLE even if it is simulated obediently, so I just write it.
A, B, C, D = map(int, input().split())
while True:
C -= B
if C <= 0:
break
A -= D
if A <= 0:
break
if A > 0:
print('Yes')
else:
print('No')
Break through in two and a half minutes. Just distinguish with set and count the number. Isn't it too easy to make a C problem?
N = int(input())
print(len(set(input() for _ in range(N))))
Defeated.
Addendum: ABC158E --Divisible Substring is a simplified problem, so AtCoder Beginner Contest 158 Participation Report See -yan / items / 87f5fd32472a964a996b # abc158e --- divisible-substring). If I hadn't skipped the review, I would have had a high performance ...
S = input()
S = S[::-1]
result = 0
t = [0] * 2019
m = 1
n = 0
for i in range(len(S)):
t[n] += 1
n += int(S[i]) * m
n %= 2019
result += t[n]
m *= 10
m %= 2019
print(result)
Recommended Posts