답안 #1065857

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1065857 2024-08-19T12:22:40 Z Energi Preokret (COCI18_preokret) Python 3
50 / 50
71 ms 3164 KB
As_Bs = [[], []]

ballAB = [0, 0] # A, B = 0, 0

for i in range(len(As_Bs)):
    A_B = int(input())# As=[int(input()) for i in range (A)]
    for time in range(A_B):
        As_Bs[i].append(int(input()))
        if As_Bs[i].count(0):
            As_Bs[i].remove(0)# убираю все нули

s = As_Bs[0] + As_Bs[1]
s.sort()
grade = 0
for i in range(len(s)):
    if s[i] > 1440:
        break
    grade += 1

progress = 0
for i in range(len(s)):
    if i == 0 and As_Bs[0].count(s[i]):
        w = 'A'
    elif i == 0 and As_Bs[1].count(s[i]):
        w = 'B'# не позволяет увеличивать progress на 1, так как не имеет значение строки
    if As_Bs[0].count(s[i]):# if s[i] in As_Bs[0]:
        ballAB[0] += 1
    elif As_Bs[1].count(s[i]):
        ballAB[1] += 1
    if ballAB[1] != 0 and ballAB[0] > ballAB[1] and w == 'B':
        progress += 1
        w = 'A'
    elif ballAB[0] != 0 and ballAB[1] > ballAB[0] and w == 'A':
        progress += 1
        w = 'B'

#Долго не мог понять как сделать так, чтобы мое значение увел. на 1 только при условии, когда одно число превысило другое
# and ballAB[1] % ballAB[0] <= 1 - чтобы мое значение было больше другого не более чем на 1
print(grade, progress, sep= '\n')
# 결과 실행 시간 메모리 Grader output
1 Correct 10 ms 2908 KB Output is correct
2 Correct 12 ms 2908 KB Output is correct
3 Correct 10 ms 2908 KB Output is correct
4 Correct 11 ms 3032 KB Output is correct
5 Correct 13 ms 2880 KB Output is correct
6 Correct 20 ms 2908 KB Output is correct
7 Correct 45 ms 3096 KB Output is correct
8 Correct 49 ms 2908 KB Output is correct
9 Correct 71 ms 3164 KB Output is correct
10 Correct 11 ms 2892 KB Output is correct