2
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?

前回の振り返り

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

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

A

条件満たすのを数えるだけだが
普通のfor文じゃなくてsumと内包表記でまとめちゃった

ソースコード

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()
    K = rI()
    
    print(sum(1 for a in A if a >= K))
    
if __name__ == '__main__':
    main()

B

minをたくさん使った

ソースコード

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, Q = rLI()
    X = rLI1()
    Y = [0]*N
    B = [0]*Q
    for i,x in enumerate(X):
        if x == -1:
            miny = min(Y)
            j = min(k for k,y in enumerate(Y) if y == miny)            
        else:
            j = x
        Y[j] += 1
        B[i] = j
    print(*(b+1 for b in B))
            
    
if __name__ == '__main__':
    main()

C

巡回シフト…

D

グラフ…

E

ステート管理とか頑張ったけどTLEした

F

grid…

G

円周上の点…

感想

大会の予選コンテストだからか難易度高めでつらい
最近は巡回シフトも食わず嫌いリストに入ってしまったorz

2
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
2
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?