0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 1 year has passed since last update.

AtCoder Beginner Contest 258 参戦記

Last updated at Posted at 2022-07-10

AtCoder Beginner Contest 258 参戦記

気づいた時点で21時10分になっていて unrated になった.

ABC258A - Last Two Digits

書くだけ.

K = int(input())

x = 21 * 60 + K
print('%02d:%02d' % (x // 60, x % 60))

ABC258B - Number Box

書くだけ. 流石に実装がアレすぎるとは思う.

N = int(input())
A = [list(map(int, input())) for _ in range(N)]

result = 0
for y in range(N):
    for x in range(N):
        t = 0
        for i in range(N):
            t = t * 10 + A[(y - i + N) % N][x]
        result = max(result, t)

        t = 0
        for i in range(N):
            t = t * 10 + A[(y - i + N) % N][(x + i) % N]
        result = max(result, t)

        t = 0
        for i in range(N):
            t = t * 10 + A[y][(x + i) % N]
        result = max(result, t)

        t = 0
        for i in range(N):
            t = t * 10 + A[(y + i) % N][(x + i) % N]
        result = max(result, t)

        t = 0
        for i in range(N):
            t = t * 10 + A[(y + i) % N][x]
        result = max(result, t)

        t = 0
        for i in range(N):
            t = t * 10 + A[(y + i) % N][(x - i + N) % N]
        result = max(result, t)

        t = 0
        for i in range(N):
            t = t * 10 + A[y][(x - i + N) % N]
        result = max(result, t)

        t = 0
        for i in range(N):
            t = t * 10 + A[(y - i + N) % N][(x - i + N) % N]
        result = max(result, t)
print(result)

ABC258C - Rotation

開始位置が変わっているだけとみなせば良い.

from sys import stdin

readline = stdin.readline

N, Q = map(int, readline().split())
S = readline()[:-1]

i = 0
result = []
for _ in range(Q):
    t, x = map(int, readline().split())
    if t == 1:
        i -= x
    elif t == 2:
        result.append(S[(i + x - 1) % len(S)])
print(*result, sep='\n')

ABC258D - Trophy

WA4. どこかの面まで進めて、ストーリースキップしてクリアしまくるのが最短. どの面がいいかはわからないけど、全て試すのが $O(N)$ で実装できるので問題なし. クリアしたあとのステージを無視しなくてボロボロ.

from sys import stdin

readline = stdin.readline

result = 10 ** 20
t = 0
N, X = map(int, readline().split())
for i in range(min(X, N)):
    A, B = map(int, readline().split())
    result = min(result, t + A + B * (X - i))
    t += A + B
print(result)
0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?