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 5 years have passed since last update.

AtCoder Beginner Contest 203 (Sponsored by Panasonic) 参戦記

0
Last updated at Posted at 2021-05-30

AtCoder Beginner Contest 203 (Sponsored by Panasonic) 参戦記

ABC203A - Chinchirorin

3分で突破. 書くだけ.

a, b, c = map(int, input().split())

x = [a, b, c]
x.sort()

if x[0] == x[1]:
    print(x[2])
elif x[1] == x[2]:
    print(x[0])
else:
    print(0)

ABC203B - AtCoder Condominium

2分半で突破. ループを回さなくても一発で求めれるような気もしたけど、書くだけだからいいやとなった.

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

result = 0
for i in range(N):
    for j in range(K):
        result += (i + 1) * 100 + (j + 1)
print(result)

ABC203C - Friends and Travel costs

6分半で突破. N≤2×105 なので O(NlogN) くらいまで大丈夫だなと思ったら、ソートして前から順に処理していけばいいよねというのが分かる.

from sys import stdin

readline = stdin.readline

N, K = map(int, readline().split())
AB = [list(map(int, readline().split())) for _ in range(N)]

AB.sort()
p = 0
result = 0
while K != 0:
    result += K
    K = 0
    while p < N and AB[p][0] <= result:
        K += AB[p][1]
        p += 1
print(result)

ABC203D - Pond

突破できず. にぶたんかなと思って実装したら TLE. 方針が間違っていたのか、実装がいまいちなのか.

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?