Skip to content

Instantly share code, notes, and snippets.

View monchy-monchy's full-sized avatar

monchy-monchy

View GitHub Profile
@monchy-monchy
monchy-monchy / ABC107 B - Grid Compression
Created August 13, 2021 02:26
ABC107 B - Grid Compression
H, W = list(map(int, input().split()))
A = []
for h in range(H):
a = list(input())
A.append(a)
row = [False] * H
col = [False] * W
@monchy-monchy
monchy-monchy / ABC108 B - Ruined Square
Created August 13, 2021 00:15
ABC108 B - Ruined Square
x1, y1, x2, y2 = list(map(int, input().split()))
x = x2 - x1
y = y2 - y1
x3 = x2 - y
y3 = y2 + x
x4 = x1 - y
y4 = y1 + x
@monchy-monchy
monchy-monchy / ABC109 B - Shiritori
Created August 7, 2021 05:24
ABC109 B - Shiritori
N = int(input())
W = []
check = True
s = ""
l = []
i = 0
for n in range(N):
W = input()
@monchy-monchy
monchy-monchy / ABC110 B - 1 Dimensional World's Tale
Created August 7, 2021 04:50
ABC110 B - 1 Dimensional World's Tale
N, M, X, Y = list(map(int, input().split()))
x = list(map(int, input().split()))
y = list(map(int, input().split()))
x.append(X)
y.append(Y)
x.sort()
y.sort()
@monchy-monchy
monchy-monchy / ABC111 B - AtCoder Beginner Contest 111
Created August 6, 2021 02:13
ABC111 B - AtCoder Beginner Contest 111
N = int(input())
c = 0
while N <= 999:
n = str(N)
if n[0] == n[1] == n[2]:
c = N
check = False
break
@monchy-monchy
monchy-monchy / ABC112 B - Time Limit Exceeded
Created August 6, 2021 02:02
ABC112 B - Time Limit Exceeded
N, T = list(map(int, input().split()))
r = 1001
check = False
for n in range(N):
x, y = list(map(int, input().split()))
if y <= T:
if x < r:
r = x
@monchy-monchy
monchy-monchy / ABC113 B - Palace
Created August 5, 2021 00:54
ABC113 B - Palace
N = int(input())
T, A = list(map(int, input().split()))
H = list(map(int, input().split()))
t = []
for n in range(N):
tem = T - H[n]*0.006
t.append(abs(A - tem))
@monchy-monchy
monchy-monchy / ABC114 B - 754
Created August 5, 2021 00:44
ABC114 B - 754
S = input()
d = []
for i in range(len(S)):
if i+3 <= len(S):
s = S[i:i+3]
d.append(abs(753-int(s)))
print(min(d))
@monchy-monchy
monchy-monchy / ABC115 B - Christmas Eve Eve
Created August 5, 2021 00:32
ABC115 B - Christmas Eve Eve
N = int(input())
p = []
for n in range(N):
p.append(int(input()))
p_max = max(p)
price = sum(p) - p_max + p_max//2
print(price)
@monchy-monchy
monchy-monchy / ABC116 B - Collatz Problem
Created August 5, 2021 00:23
ABC116 B - Collatz Problem
S = int(input())
s = S
l = [s]
check = True
i = 1
while check:
i += 1
if s%2 == 0: