Round #827/1742 (Div. 4)

Updated: 2023-03-23

#TODO D E F G

Contest date: 2022-10-13

A. Sum

https://codeforces.com/contest/1742/problem/A

Solution:

def inp_int_list(): return list(map(int, inp().split()))

def solve():
arr = inp_int_list()
arr.sort()
if arr[0] + arr[1] == arr[2]:
print('YES')
else:
print('NO')

def run():
for _ in range(inp_int()):
solve()

if __name__ == "__main__":
CODE_DEBUG = 0
if os.environ.get("CODE_DEBUG") or CODE_DEBUG:
sys.stdin = open("./input.txt", "r")
start_time = time.time()
run()
print("\n--- %s seconds ---\n" % (time.time() - start_time))
else:
run()


B. Increasing

https://codeforces.com/contest/1742/problem/B

Solution:

def solve():
n = inp_int()
arr = inp_int_list()
unique = set(arr)
if n == len(unique):
print('YES')
else:
print('NO')


Explanation from Codeforces:

If there are two elements with the same value, then the answer is NO, because neither of these values is less than the other.

Otherwise, the answer is YES, since we can just sort the array.

C. Stripes

https://codeforces.com/contest/1742/problem/C

Assuming that row or col exists with letter, check all rows for horizontal red rows. If not then answer is B.

Solution:

def solve():
inp()
grid = [inp() for _ in range(8)]
for row in grid:
if all(c == 'R' for c in row):
print('R')
return
print('B')
return


Explanation from Codeforces:

Note that if a stripe is painted last, then the entire stripe appears in the final picture (because no other stripe is covering it).

Since rows are only painted red and columns are only painted blue, we can just check if any row contains 8 Rs. If there is such a row, then red was painted last; otherwise, blue was painted last.

D. Coprime

https://codeforces.com/contest/1742/problem/D

Solution:

E. Scuza

https://codeforces.com/contest/1742/problem/E

Solution:

F. Smaller

https://codeforces.com/contest/1742/problem/F

Slow Solution:

G. Orray

https://codeforces.com/contest/1742/problem/G1