AtCoder Beginner Contest 182 Participation Report

AtCoder Beginner Contest 182 Participation Report

ABC182A - twiblr

Break through in 1 minute. Just write.

A, B = map(int, input().split())

print(2 * A + 100 - B)

ABC182B - Almost GCD

Break through in 4 minutes. I was a little worried, but realized that I should try everything.

N, *A = map(int, open(0).read().split())

result = 0
for i in range(2, 1000):
    t = 0
    for a in A:
        if a % i == 0:
            t += 1
    result = max(result, t)
print(result)

ABC182C - To 3

Break through in 6 minutes. Needless to say, if the total number of each digit is a multiple of 3, then it is a multiple of 3. So, if the total number of each digit is divided by 3, then the remainder is considered first. The story is over because it is a multiple of 3 from. If the remainder is 1 or 2, it will always be a multiple of 3 if you erase 1 or 2 digits, but you need to check if there are enough digits to erase.

N = input()

t = [int(c % 3) for c in N]
x = sum(t)

if x % 3 == 0:
    print(0)
elif x % 3 == 1:
    if 1 in t:
        print(1)
    else:
        print(2)
elif x % 3 == 2:
    if 2 in t:
        print(1)
    else:
        print(2)

ABC182D - Wandering

Break through in 17 minutes. It's easy to see that the coordinates at the start of each round are the sum of the cumulative sums up to that point. The maximum coordinates for each round are the coordinates at the start of each round. Since it is the sum of the maximum values, you can take the maximum of them.

from itertools import accumulate

N, *A = map(int, open(0).read().split())

a = list(accumulate(A))

result = 0
c = 0
m = 0
for i in range(N):
    m = max(a[i], m)
    result = max(result, c + m)
    c += a[i]
print(result)

ABC182E - Akari

Break through in 60 minutes. I thought too hard. I should have painted it without thinking ...

from sys import stdin

readline = stdin.readline

H, W, N, M = map(int, readline().split())
AB = [tuple(map(lambda x: int(x) - 1, readline().split())) for _ in range(N)]
CD = [tuple(map(lambda x: int(x) - 1, readline().split())) for _ in range(M)]

t = [[0] * W for _ in range(H)]

ly = [[] for _ in range(H)]
lt = [[] for _ in range(W)]
for a, b in AB:
    ly[a].append(b)
    lt[b].append(a)
for i in range(H):
    ly[i].sort()
for i in range(W):
    lt[i].sort()

by = [[] for _ in range(H)]
bt = [[] for _ in range(W)]
for c, d in CD:
    by[c].append(d)
    bt[d].append(c)
for i in range(H):
    by[i].append(W)
    by[i].sort()
for i in range(W):
    bt[i].append(H)
    bt[i].sort()

result = 0
for h in range(H):
    lyh = ly[h]
    i = 0
    pd = -1
    for d in by[h]:
        j = i
        while j < len(lyh) and lyh[j] < d:
            j += 1
        if i != j:
            for w in range(pd + 1, d):
                t[h][w] = 1
            i = j
        pd = d
for w in range(W):
    ltw = lt[w]
    i = 0
    pc = -1
    for c in bt[w]:
        j = i
        while j < len(ltw) and ltw[j] < c:
            j += 1
        if i != j:
            for h in range(pc + 1, c):
                t[h][w] = 1
            i = j
        pc = c
print(sum(sum(x) for x in t))

Recommended Posts

AtCoder Beginner Contest 181 Participation Report
AtCoder Beginner Contest 161 Participation Report
AtCoder Beginner Contest 151 Participation Report
AtCoder Beginner Contest 176 Participation Report
AtCoder Beginner Contest 154 Participation Report
AtCoder Beginner Contest 166 Participation Report
AtCoder Beginner Contest 153 Participation Report
AtCoder Beginner Contest 145 Participation Report
AtCoder Beginner Contest 184 Participation Report
AtCoder Beginner Contest 165 Participation Report
AtCoder Beginner Contest 160 Participation Report
AtCoder Beginner Contest 169 Participation Report
AtCoder Beginner Contest 178 Participation Report
AtCoder Beginner Contest 163 Participation Report
AtCoder Beginner Contest 159 Participation Report
AtCoder Beginner Contest 168 Participation Report
AtCoder Beginner Contest 158 Participation Report
AtCoder Beginner Contest 180 Participation Report
AtCoder Beginner Contest 156 Participation Report
AtCoder Beginner Contest 162 Participation Report
AtCoder Beginner Contest 157 Participation Report
AtCoder Beginner Contest 179 Participation Report
AtCoder Beginner Contest 182 Participation Report
AtCoder Beginner Contest 146 Participation Report
AtCoder Beginner Contest 152 Participation Report
AtCoder Beginner Contest 155 Participation Report
AtCoder Beginner Contest 174 Participation Report
AtCoder Beginner Contest 171 Participation Report
AtCoder Beginner Contest 149 Participation Report
AtCoder Beginner Contest 148 Participation Report
AtCoder Beginner Contest 188 Participation Report
AtCoder Beginner Contest 170 Participation Report
AtCoder Beginner Contest 187 Participation Report
AtCoder Beginner Contest 183 Participation Report
AtCoder Beginner Contest # 003 Participation Note
AtCoder Grand Contest 041 Participation Report
AtCoder Grand Contest 040 Participation Report
AtCoder Regular Contest 105 Participation Report
AtCoder Regular Contest 104 Participation Report
ACL Beginner Contest Participation Report
Atcoder Beginner Contest 146 Participation Diary
AtCoder Chokudai Contest 005 Participation Report
AtCoder Grand Contest 047 Participation Report
AtCoder Beginner Contest 177
AtCoder Beginner Contest 179
AtCoder Beginner Contest 172
AtCoder Beginner Contest 180
AtCoder Beginner Contest 173
Atcoder Beginner Contest 153
AtCoder Acing Programming Contest 2020 Participation Report
AtCoder Keyence Programming Contest 2020 Participation Report
AtCoder Panasonic Programming Contest 2020 Participation Report
AtCoder Beginner Contest 152 Review
AtCoder Beginner Contest 181 Note
AtCoder Beginner Contest 187 Note
AtCoder Beginner Contest 160 Review
AtCoder Beginner Contest 178 Review
AtCoder Beginner Contest 180 Note
AtCoder Beginner Contest 166 Review
AtCoder Beginner Contest 167 Review
AtCoder Library Practice Contest Participation Report (Python)