結果

問題 No.2401 Dirty Shoes and Stairs
ユーザー ch1channn
提出日時 2023-08-07 08:41:43
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 111 ms / 2,000 ms
コード長 923 bytes
コンパイル時間 418 ms
コンパイル使用メモリ 82,432 KB
実行使用メモリ 116,352 KB
最終ジャッジ日時 2024-11-07 12:23:10
合計ジャッジ時間 3,519 ms
ジャッジサーバーID
(参考情報)
judge5 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 30
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
if sys.platform =='ios':
	import clipboard
	a=clipboard.get()
	a = a.split('\n')
	text = '\n'.join(a)
	with open('input_file.txt','w') as f:
		f.write(text)
	sys.stdin = open('input_file.txt')
#sys.setrecursionlimit(410000000)
stdin = sys.stdin 
ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
ns = lambda: stdin.readline().strip()
nm = lambda: map(int,input().split())
na_1 = lambda: list(map(lambda x:int(x)*(-1), stdin.readline().split()))
na_2 = lambda: list(map(lambda x:int(x)-1, stdin.readline().split()))
rnage=range
rnge=range
rage = range
rnag=range

N = ni()
M = ni()
A = na()
M2 = ni()
B = na()

kitanai = [False]*(N+1)
kitanai[0] = True
kitanai[-1] = True
kitanai[A[0]] = True
pre = A[0]
for i in range(1,M):
	kitanai[A[i]+pre] = True
	pre += A[i]
	
kitanai[N-B[0]] = True
pre = B[0]
for i in range(1,M2):
	kitanai[N-B[i]-pre] = True
	pre += B[i]
print(N+1-sum(kitanai))
0