提出 #68897571


ソースコード 拡げる

from sys import stdin, setrecursionlimit
from bisect import bisect_left, bisect_right
from math import ceil, floor, gcd, factorial, sqrt, log2, log
from collections import Counter, defaultdict, deque
from functools import lru_cache, reduce
from heapq import heapify, heappop, heappush, heappushpop
from itertools import accumulate, combinations, permutations
from operator import add, iand, ior, mul, xor
from string import ascii_lowercase, ascii_uppercase

input = lambda: stdin.readline().rstrip("\r\n")

# --------------------
# 手写栈模板
# 克服py栈太浅的问题
from types import GeneratorType


def bootstrap(f, stack=[]):
    def wrappedfunc(*args, **kwargs):
        if stack:
            return f(*args, **kwargs)
        else:
            to = f(*args, **kwargs)
            while True:
                if type(to) is GeneratorType:
                    stack.append(to)
                    to = next(to)
                else:
                    stack.pop()
                    if not stack:
                        break
                    to = stack[-1].send(to)
            return to

    return wrappedfunc
# --------------------


def I():
    return input()


def II():
    return int(input())


def MII():
    return map(int, input().split())


def LI():
    return list(input().split())


def LII():
    return list(map(int, input().split()))


def GMI():
    return map(lambda x: int(x) - 1, input().split())


def LGMI():
    return list(map(lambda x: int(x) - 1, input().split()))


def isPrimeMR(n):
    if n <= 1:
        return 0
    if n == 2 or n == 7 or n == 61:
        return 1
    d = n - 1
    d = d // (d & -d)
    L = [2, 7, 61] if n < 1 << 32 else [2, 3, 5, 7, 11, 13, 17] if n < 1 << 48 else [2, 3, 5, 7, 11, 13, 17, 19, 23, 29,
                                                                                     31, 37]
    for a in L:
        t = d
        y = pow(a, t, n)
        if y == 1: continue
        while y != n - 1:
            y = y * y % n
            if y == 1 or t == n - 1: return 0
            t <<= 1
    return 1

def findFactorRho(n):
    m = 1 << n.bit_length() // 8
    for c in range(1, 99):
        f = lambda x: (x * x + c) % n
        y, r, q, g = 2, 1, 1, 1
        while g == 1:
            x = y
            for i in range(r):
                y = f(y)
            k = 0
            while k < r and g == 1:
                ys = y
                for i in range(min(m, r - k)):
                    y = f(y)
                    q = q * abs(x - y) % n
                g = gcd(q, n)
                k += m
            r <<= 1
        if g == n:
            g = 1
            while g == 1:
                ys = f(ys)
                g = gcd(abs(x - ys), n)
        if g < n:
            if isPrimeMR(g):
                return g
            elif isPrimeMR(n // g):
                return n // g
            return findFactorRho(g)
        
def primeFactor(n):
    i = 2
    ret = {}
    rhoFlg = 0
    while i * i <= n:
        k = 0
        while n % i == 0:
            n //= i
            k += 1
        if k: ret[i] = k
        i += i % 2 + (3 if i % 3 == 1 else 1)
        if i == 101 and n >= 2 ** 20:
            while n > 1:
                if isPrimeMR(n):
                    ret[n], n = 1, 1
                else:
                    rhoFlg = 1
                    j = findFactorRho(n)
                    k = 0
                    while n % j == 0:
                        n //= j
                        k += 1
                    ret[j] = k
    if n > 1: ret[n] = 1
    if rhoFlg: ret = {x: ret[x] for x in sorted(ret)}
    return ret

def divisors(N):
    pf = primeFactor(N)
    ret = [1]
    for p in pf:
        ret_prev = ret
        ret = []
        for i in range(pf[p] + 1):
            for r in ret_prev:
                ret.append(r * (p ** i))
    return sorted(ret)


def iii():
    num = 0
    neg = False
    while True:
        c = stdin.read(1)
        if c == '-':
            neg = True
            continue
        elif c < '0' or c > '9':
            continue
        while True:
            num = 10 * num + ord(c) - ord('0')
            c = stdin.read(1)
            if c < '0' or c > '9':
                break
        return -num if neg else num

# setrecursionlimit(int(1e5 + 10))#根据需要调整递归深度
dx, dy = [0, 1, 0, -1, 1, -1, 1, -1], [1, 0, -1, 0, -1, -1, 1, 1]
inf = float('inf')
# import random
# RANDOM = random.randint(int(1e9 + 7), int(2e9 + 7)) # 防止卡哈希
mod = int(1e9 + 7)
# mod = 998244353

def solve():
    a = [I() for _ in range(II())]
    i, s = LI()
    print("Yes" if a[int(i) - 1] == s else "No")
    return


if __name__ == '__main__':
    # 1多组数据,0单组数据
    t = 0   
    if t:
        t = II()
        for _ in range(t):
            solve()
    else:
        solve()

提出情報

提出日時
問題 A - Misdelivery
ユーザ KongShuiLinHua
言語 Python (PyPy 3.10-v7.3.12)
得点 100
コード長 5033 Byte
結果 AC
実行時間 118 ms
メモリ 83220 KiB

ジャッジ結果

セット名 Sample All
得点 / 配点 0 / 0 100 / 100
結果
AC × 4
AC × 12
セット名 テストケース
Sample sample_01.txt, sample_02.txt, sample_03.txt, sample_04.txt
All random_01.txt, random_02.txt, random_03.txt, random_04.txt, random_05.txt, random_06.txt, random_07.txt, random_08.txt, sample_01.txt, sample_02.txt, sample_03.txt, sample_04.txt
ケース名 結果 実行時間 メモリ
random_01.txt AC 117 ms 82840 KiB
random_02.txt AC 116 ms 82916 KiB
random_03.txt AC 117 ms 83188 KiB
random_04.txt AC 116 ms 83220 KiB
random_05.txt AC 116 ms 82952 KiB
random_06.txt AC 116 ms 82880 KiB
random_07.txt AC 116 ms 83024 KiB
random_08.txt AC 118 ms 82832 KiB
sample_01.txt AC 117 ms 82744 KiB
sample_02.txt AC 118 ms 83036 KiB
sample_03.txt AC 117 ms 82924 KiB
sample_04.txt AC 117 ms 83048 KiB