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?

ABC390振り返り

Posted at

前回の振り返り

今日はABC開催日だったので参加結果を振り返る

今週はA,Cの2完(1ペナ)

A

隣り合うものしか交換していけないのを見落として1ペナ

ソースコード

main.py
from bisect import bisect_left, bisect_right, insort_left, insort_right
from collections import defaultdict, Counter, deque
from functools import reduce, lru_cache
from itertools import product, accumulate, groupby, combinations
import sys
import os
def rI(): return int(sys.stdin.readline().rstrip())
def rLI(): return list(map(int,sys.stdin.readline().rstrip().split()))
def rI1(): return (int(sys.stdin.readline().rstrip())-1)
def rLI1(): return list(map(lambda a:int(a)-1,sys.stdin.readline().rstrip().split()))
def rS(): return sys.stdin.readline().rstrip()
def rLS(): return list(sys.stdin.readline().rstrip().split())
IS_LOCAL = int(os.getenv("ATCODER", "0"))==0
err = (lambda *args, **kwargs: print(*args, **kwargs, file=sys.stderr)) if IS_LOCAL else (lambda *args, **kwargs: None)

def main():
    A = tuple(rLI())
    X = [i+1 for i in range(5)]
    
    for i in range(4):
        j = i+1
        Y = X[:]
        Y[i], Y[j] = Y[j], Y[i]
        if A==tuple(Y):
            print("Yes")
            break
    else:
        print("No")
        
    
if __name__ == '__main__':
    main()

B

Counterで横着しようとしてWA4回でたので未完のままスルー

ソースコード

WAコード
main.py
from bisect import bisect_left, bisect_right, insort_left, insort_right
from collections import defaultdict, Counter, deque
from functools import reduce, lru_cache
from itertools import product, accumulate, groupby, combinations
import sys
import os
def rI(): return int(sys.stdin.readline().rstrip())
def rLI(): return list(map(int,sys.stdin.readline().rstrip().split()))
def rI1(): return (int(sys.stdin.readline().rstrip())-1)
def rLI1(): return list(map(lambda a:int(a)-1,sys.stdin.readline().rstrip().split()))
def rS(): return sys.stdin.readline().rstrip()
def rLS(): return list(sys.stdin.readline().rstrip().split())
IS_LOCAL = int(os.getenv("ATCODER", "0"))==0
err = (lambda *args, **kwargs: print(*args, **kwargs, file=sys.stderr)) if IS_LOCAL else (lambda *args, **kwargs: None)

def main():
    N = rI()
    A = rLI()
    r = []
    for i,a in enumerate(A[1:],start=1):
        r.append(a/A[i-1]) 
    # err(r)
    
    c = Counter(r)
    
    ans = len(c.keys())==1
    print('Yes' if ans else 'No')
    
if __name__ == '__main__':
    main()

C

黒固定のところの左上、右下を特定

その範囲の中で白固定がなければOK

ソースコード

main.py
from bisect import bisect_left, bisect_right, insort_left, insort_right
from collections import defaultdict, Counter, deque
from functools import reduce, lru_cache
from itertools import product, accumulate, groupby, combinations
import sys
import os
def rI(): return int(sys.stdin.readline().rstrip())
def rLI(): return list(map(int,sys.stdin.readline().rstrip().split()))
def rI1(): return (int(sys.stdin.readline().rstrip())-1)
def rLI1(): return list(map(lambda a:int(a)-1,sys.stdin.readline().rstrip().split()))
def rS(): return sys.stdin.readline().rstrip()
def rLS(): return list(sys.stdin.readline().rstrip().split())
IS_LOCAL = int(os.getenv("ATCODER", "0"))==0
err = (lambda *args, **kwargs: print(*args, **kwargs, file=sys.stderr)) if IS_LOCAL else (lambda *args, **kwargs: None)

def main():
    H, W = rLI()
    grid = [0]*H
    minx=float('inf')
    miny=float('inf')
    maxx=0
    maxy=0
    for i in range(H):
        S = rS()
        grid[i] = list(S)
        # err(S)
        for j,s in enumerate(S):
            if s == "#":
                minx = min(minx,j)
                miny = min(miny,i)
                maxx = max(maxx,j)
                maxy = max(maxy,i)
    # err(minx,miny)
    # err(maxx,maxy)
    for i in range(miny,maxy+1):
        for j in range(minx,maxx+1):
            if grid[i][j] == ".":
                return False
    return True
if __name__ == '__main__':
    ans = main()
    print("Yes" if ans else "No")
    

D

成約からのメタで全探索すればいいのはわかったが、
どうすれば全探索できるのかパッと思いつかず
通してる人数Eの方が多かったからパス

E

動的計画法でいけるとは思ったが
実装でうまくいかず撃沈

F,G

Eで沼って、チラ見する余裕なく終了

まとめ

せっかく解けそうなE問題だったが通せず、痛梱の一撃

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?