Another day another TLE

Правка en1, от ritik652000, 2021-04-13 12:39:32

Can someone tell me why my solution is getting TLE in Educational Round 107C

its complexity is O(Q*Ai) Q <= 3*(10^5) Ai <= 50

Link to Ques = https://codeforces.me/contest/1511/problem/C

import math
a,b = map(int,input().split())
arr = list(map(int,input().split()))
brr = list(map(int,input().split()))
t = [0]*(max(arr)+1)
for i in range(a):
    if(t[arr[i]]==0):
        t[arr[i]] = i+1
for i in range(b):
    print(t[brr[i]],end = " ")
    for j in range(len(t)):
        if(t[j]<t[brr[i]]):
            t[j]+=1
    t[brr[i]] = 1
Теги #tle, #educational round, #c

История

 
 
 
 
Правки
 
 
  Rev. Язык Кто Когда Δ Комментарий
en1 Английский ritik652000 2021-04-13 12:39:32 598 Initial revision (published)