結果

問題 No.2401 Dirty Shoes and Stairs
ユーザー mono_0812mono_0812
提出日時 2023-08-04 21:26:23
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 181 ms / 2,000 ms
コード長 1,878 bytes
コンパイル時間 87 ms
コンパイル使用メモリ 12,928 KB
実行使用メモリ 16,276 KB
最終ジャッジ日時 2024-04-22 19:46:29
合計ジャッジ時間 3,564 ms
ジャッジサーバーID
(参考情報)
judge5 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 41 ms
12,160 KB
testcase_01 AC 41 ms
12,416 KB
testcase_02 AC 40 ms
12,160 KB
testcase_03 AC 95 ms
14,956 KB
testcase_04 AC 108 ms
14,316 KB
testcase_05 AC 60 ms
13,176 KB
testcase_06 AC 93 ms
15,352 KB
testcase_07 AC 144 ms
15,772 KB
testcase_08 AC 86 ms
13,768 KB
testcase_09 AC 48 ms
12,672 KB
testcase_10 AC 74 ms
13,160 KB
testcase_11 AC 181 ms
15,956 KB
testcase_12 AC 147 ms
16,276 KB
testcase_13 AC 54 ms
13,824 KB
testcase_14 AC 52 ms
13,568 KB
testcase_15 AC 49 ms
13,440 KB
testcase_16 AC 46 ms
12,800 KB
testcase_17 AC 50 ms
13,312 KB
testcase_18 AC 54 ms
13,824 KB
testcase_19 AC 50 ms
13,440 KB
testcase_20 AC 43 ms
12,544 KB
testcase_21 AC 45 ms
12,928 KB
testcase_22 AC 50 ms
13,440 KB
testcase_23 AC 53 ms
13,824 KB
testcase_24 AC 45 ms
12,928 KB
testcase_25 AC 48 ms
12,928 KB
testcase_26 AC 41 ms
12,288 KB
testcase_27 AC 47 ms
12,928 KB
testcase_28 AC 51 ms
13,824 KB
testcase_29 AC 47 ms
13,184 KB
testcase_30 AC 43 ms
12,672 KB
testcase_31 AC 54 ms
14,080 KB
testcase_32 AC 44 ms
12,800 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

############################################################################################
import bisect,collections,copy,heapq,itertools,math,string,sys,queue,time,random
from decimal import Decimal
def I(): return input()
def IS(): return input().split()
def II(): return int(input())
def IIS(): return list(map(int,input().split()))
def LIIS(): return list(map(int,input().split()))

def make_divisors(n):
    lower_divisors , upper_divisors = [], []
    i = 1
    while i*i <= n:
        if n % i == 0:
            lower_divisors.append(i)
            if i != n // i:
                upper_divisors.append(n//i)
        i += 1
    return lower_divisors + upper_divisors[::-1]

import math

def prime_numbers(n):
    prime = [True for i in range(n+1)]
    prime[0] = False
    prime[1] = False

    sqrt_n = math.ceil(math.sqrt(n))
    for i in range(2, sqrt_n):
        if prime[i]:
            for j in range(2*i, n+1, i):
                prime[j] = False
    numbers=[]
    for i in range(2,n+1):
        if prime[i]:
            numbers.append(i)

    return numbers

def factorization(n):
    arr = []
    temp = n
    for i in range(2, int(-(-n**0.5//1))+1):
        if temp%i==0:
            cnt=0
            while temp%i==0:
                cnt+=1
                temp //= i
            arr.append([i, cnt])
 
    if temp!=1:
        arr.append([temp, 1])
 
    if arr==[]:
        arr.append([n, 1])
 
    return arr
 
INF=float("inf")
MOD=998244353
MOD2=10**9+7
sys.setrecursionlimit(500005)
def bit_count(x):
    return bin(x).count("1")
def yesno(f):
    if f:print("Yes")
    else:print("No")
####################################################
n=II()
m1=II()
A=LIIS()
m2=II()
B=LIIS()
li=[0 for i in range(n+1)]
li[0]=1
li[n]=1

cnt=0
for i in range(m1):
    cnt+=A[i]
    li[cnt]=1

cnt=n
for i in range(m2):
    cnt-=B[i]
    li[cnt]=1

print(n-sum(li)+1)
0