月曜日, 6月 30, 2025
月曜日, 6月 30, 2025
- Advertisment -
ホームニューステックニュースABC412振り返り #Python - Qiita

ABC412振り返り #Python – Qiita



ABC412振り返り #Python - Qiita

前回の振り返り

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

今週は A, B の2完(0ペナ)

条件合うか読み取りのときにチェック

ソースコード

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()
    
    c = 0
    for _ in range(N):
        A, B = rLI()
        if A  B : c+=1
    print(c)
if __name__ == '__main__':
    main()

先頭以外の大文字内包表記で取り出すのがコツ

ソースコード

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():
    S = rS()
    T = rS()
    u = [i for i,s in enumerate(S[1:],1) if s.isupper()]
    for i in u:
        if S[i-1] not in T:
            print("No")
            return
    print("Yes")
    
if __name__ == '__main__':
    main()

挿入するドミノの選択と終了条件の判断を混乱しすぎて実装に時間をかけるも
TLE+1WAとかいうので心折れました

グラフというワード見てそっ閉じ

数学的考察力が足らなかった

確率論だぁ…

問題に出てくるの良い〇〇シリーズすき

精進の時間取れてないからか
最近本当に地力落ちてる





Source link

Views: 0

RELATED ARTICLES

返事を書く

あなたのコメントを入力してください。
ここにあなたの名前を入力してください

- Advertisment -