提出 #69306317


ソースコード 拡げる

import sys
import os
from math import ceil, floor, sqrt, pi, factorial, gcd,lcm,sin,cos,tan,asin,acos,atan2,exp,log,log10, isqrt, comb
from collections import Counter, defaultdict, deque
from copy import deepcopy
from functools import cmp_to_key, lru_cache, reduce, cache
from operator import add, iand, ior, itemgetter, mul, xor
from string import ascii_lowercase, ascii_uppercase, ascii_letters
from typing import *
from bisect import bisect, bisect_left, bisect_right
from heapq import heapify, heappop, heappush, heappushpop, nlargest, nsmallest
from sortedcontainers import SortedSet, SortedList, SortedDict
from itertools import product, accumulate,permutations,combinations, count, groupby
input = lambda: sys.stdin.readline().rstrip("\r\n")
I = input
II = lambda: int(I())
LI = lambda: list(input().split())
LII = lambda: list(map(int, input().split()))
sys.setrecursionlimit(10000000)
inf = float('inf')

N = II()
L = LII()

a = N
for i in range(N):
    if L[i] == 1:
        a = i
        break

b = 0
for i in range(N)[::-1]:
    if L[i] == 1:
        b = i
        break

if a == N:
    print(0)
else:
    print(b - a)

提出情報

提出日時
問題 B - Locked Rooms
ユーザ GeekMasahiro
言語 Python (PyPy 3.10-v7.3.12)
得点 200
コード長 1130 Byte
結果 AC
実行時間 158 ms
メモリ 86460 KiB

ジャッジ結果

セット名 Sample All
得点 / 配点 0 / 0 200 / 200
結果
AC × 3
AC × 27
セット名 テストケース
Sample sample00.txt, sample01.txt, sample02.txt
All sample00.txt, sample01.txt, sample02.txt, testcase00.txt, testcase01.txt, testcase02.txt, testcase03.txt, testcase04.txt, testcase05.txt, testcase06.txt, testcase07.txt, testcase08.txt, testcase09.txt, testcase10.txt, testcase11.txt, testcase12.txt, testcase13.txt, testcase14.txt, testcase15.txt, testcase16.txt, testcase17.txt, testcase18.txt, testcase19.txt, testcase20.txt, testcase21.txt, testcase22.txt, testcase23.txt
ケース名 結果 実行時間 メモリ
sample00.txt AC 157 ms 86324 KiB
sample01.txt AC 153 ms 86460 KiB
sample02.txt AC 155 ms 86288 KiB
testcase00.txt AC 154 ms 86448 KiB
testcase01.txt AC 153 ms 86200 KiB
testcase02.txt AC 156 ms 86336 KiB
testcase03.txt AC 157 ms 86376 KiB
testcase04.txt AC 153 ms 86372 KiB
testcase05.txt AC 155 ms 86268 KiB
testcase06.txt AC 153 ms 86028 KiB
testcase07.txt AC 153 ms 86144 KiB
testcase08.txt AC 156 ms 86284 KiB
testcase09.txt AC 155 ms 86452 KiB
testcase10.txt AC 153 ms 86412 KiB
testcase11.txt AC 154 ms 86344 KiB
testcase12.txt AC 156 ms 86424 KiB
testcase13.txt AC 155 ms 86340 KiB
testcase14.txt AC 155 ms 86288 KiB
testcase15.txt AC 153 ms 86236 KiB
testcase16.txt AC 154 ms 86440 KiB
testcase17.txt AC 156 ms 86436 KiB
testcase18.txt AC 156 ms 86408 KiB
testcase19.txt AC 156 ms 86352 KiB
testcase20.txt AC 156 ms 86268 KiB
testcase21.txt AC 157 ms 86456 KiB
testcase22.txt AC 155 ms 86192 KiB
testcase23.txt AC 158 ms 86156 KiB