답안 #164576

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
164576 2019-11-21T16:05:03 Z itiam Zamjena (COCI18_zamjena) Python 3
14 / 70
1000 ms 4968 KB
def provjera(L1,L2):
    A,B=[],[]
    for i in range(len(L1)):
        if L1[i]!=L2[i]:
            A.append(L1[i])
            B.append(L2[i])
    return A,B
        
def main():
    N=int(input())
    L=input().split()
    L2=input().split()
    #print('L:',L,'L2:',L2)
    L,L2=provjera(L,L2)
    #print('NAKON    L:',L,'L2:',L2)
    while L!=[]:
        for i in range(len(L)):
            if L[i].isdigit() and L2[i].isdigit():
                print("NE")
                return
            elif (L[i].isdigit() is not True) and L2[i].isdigit():
                for j in range(len(L)):
                    if L[j]==L[i]:  L[j]=L2[i]
                    if L2[j]==L[i]:  L2[j]=L2[i]
            elif (L2[i].isdigit() is not True) and L[i].isdigit():
                for j in range(len(L)):
                    if L[j]==L2[i]:  L[j]=L[i]
                    if L2[j]==L2[i]:  L2[j]=L[i]
            elif (L[i].isdigit() is not True) and (L2[i].isdigit() is not True):
                for j in range(len(L)):
                    if L[j]==L2[i]:  L[j]=L[i]
                    if L2[j]==L2[i]:  L2[j]=L[i]
        L,L2=provjera(L,L2)
    print("DA")
    return

main()
# 결과 실행 시간 메모리 Grader output
1 Correct 25 ms 3428 KB Output is correct
2 Correct 25 ms 3428 KB Output is correct
3 Correct 29 ms 3428 KB Output is correct
4 Correct 45 ms 3428 KB Output is correct
5 Correct 25 ms 3368 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 25 ms 3404 KB Output is correct
2 Incorrect 26 ms 3428 KB Output isn't correct
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 26 ms 3428 KB Output is correct
2 Correct 26 ms 3428 KB Output is correct
3 Incorrect 25 ms 3420 KB Output isn't correct
4 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 296 ms 3556 KB Output is correct
2 Correct 282 ms 3432 KB Output is correct
3 Execution timed out 1077 ms 3816 KB Time limit exceeded
4 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 1065 ms 4968 KB Time limit exceeded
2 Halted 0 ms 0 KB -