Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

LIOJ #1047 搜尋數字 PY3 TLE #432

Open
aa846301 opened this issue Nov 18, 2022 · 0 comments
Open

LIOJ #1047 搜尋數字 PY3 TLE #432

aa846301 opened this issue Nov 18, 2022 · 0 comments

Comments

@aa846301
Copy link

aa846301 commented Nov 18, 2022

def search(arr , t):
for i in range(len(arr)):
if arr[i] == t:
return i
return "-1"

n, m = map(int, input().split())
nums = [int(input()) for _ in range(n)]
for _ in range(m):
t = int(input())
print(search(nums,t))

按照老師的作法,沒有辦法在同樣的時間複雜度下通過測試,希望放開一些標準,

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant