Submission #164529

# Submission time Handle Problem Language Result Execution time Memory
164529 2019-11-21T10:28:32 Z boolodifjenula Programiranje (COCI17_programiranje) Python 3
24 / 80
3000 ms 4084 KB
s=input()
Q=int(input())
O=[]
for i in range (Q):
    A,B,C,D=map(int,input().split())
    X=s[A-1:B]
    Y=s[C-1:D]
    for j in range(B-A+1):
        t=0
        for c in range(B-A+1):
            if c==len(Y):
                break
            if Y[c]==X[j]:
                Y=Y[:c]+Y[c+1:]
                t=1
                break
        if t==0:
            O+=["NE"]
            break
    if t: O+=["DA"]
for i in range(Q):
    print(O[i])
    

        
# Verdict Execution time Memory Grader output
1 Correct 2705 ms 3728 KB Output is correct
2 Execution timed out 3034 ms 3700 KB Time limit exceeded
3 Correct 2891 ms 3688 KB Output is correct
4 Execution timed out 3044 ms 3680 KB Time limit exceeded
5 Correct 2987 ms 3668 KB Output is correct
6 Execution timed out 3034 ms 4084 KB Time limit exceeded
7 Execution timed out 3028 ms 4080 KB Time limit exceeded
8 Execution timed out 3033 ms 3948 KB Time limit exceeded
9 Execution timed out 3036 ms 3884 KB Time limit exceeded
10 Execution timed out 3058 ms 4008 KB Time limit exceeded