Another day another TLE

Revision en1, by 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.net/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
Tags #tle, #educational round, #c

History

 
 
 
 
Revisions
 
 
  Rev. Lang. By When Δ Comment
en1 English ritik652000 2021-04-13 12:39:32 598 Initial revision (published)