Submission #24956

# Submission time Handle Problem Language Result Execution time Memory
24956 2017-06-18T07:19:48 Z leejseo 구간 성분 (KOI15_interval) Python 2
0 / 100
1000 ms 41 KB
def solve(A, B):
    n = len(A)
    m = len(B)
    common = 0
    L = []
    M = []
    for i in range(n):
        for j in range(i+1, n):
            s = A[i:j]
            u = []
            for k in s:
                u.append(k)
            u.sort()
            L.append(u)
    for i in range(m):
        for j in range(i+1, m):
            s = B[i:j]
            u = []
            for k in s:
                u.append(k)
            u.sort()
            M.append(u)
    for i in L:
        for j in M:
            if i == j and common < len(i):
                common = len(i)
    return common

def main():
    A = raw_input()
    B = raw_input()
    print solve(A, B)
    return
main()
# Verdict Execution time Memory Grader output
1 Correct 21 ms 2 KB Output is correct
2 Correct 119 ms 3 KB Output is correct
3 Execution timed out 1083 ms 6 KB Time limit exceeded
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1075 ms 36 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1079 ms 36 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1082 ms 41 KB Time limit exceeded
2 Halted 0 ms 0 KB -