Run ID 作者 问题 语言 测评结果 Time Memory 代码长度 提交时间
154176 王一诺 18第一次出现与最后一次出现的位置 Python3 Accepted 47 MS 3940 KB 321 2026-05-24 16:12:01

Tests(10/10):


Code:

input() d=0 a=list(map(int,input().split())) b=int(input()) if b not in a: print(-1) else: c= 0 d =0 f = 0 for i in range(len(a)): if a[i]==b and f == 0: c=i+1 d = c f = 1 elif a[i]==b: d = i+1 print("{} {}".format(c,d))