/ SeriousOJ /

Record Detail

Time Exceeded


  
# Status Time Cost Memory Cost
#1 Accepted 14ms 3.023 MiB
#2 Accepted 1249ms 3.133 MiB
#3 Time Exceeded ≥3097ms ≥3.023 MiB

Code

for _ in range(int(input())):

    x , y = map(int, input().split())
    

    
    if x == 1 or y == 1:
        print("-1")
    else:
        flag = 0
        ans = 0
        if x > y:
            for i in range(2,y+1):
                if x% i == 0 and y%i == 0:
                    
                    flag = 0
                    print(i)
                    break
                else:
                    flag = 1
        if flag == 1:
            print(-1)
        else:
            for i in range(2,x+1):
                if x% i == 0 and y%i == 0:
                        flag = 0
                        print(i)
                        break
                else:
                    flag = 1
            if flag == 1:
                print(-1)

    

Information

Submit By
Type
Submission
Problem
P1011 LCD
Contest
Brain booster - 1
Language
Python 3 (Python 3.12.3)
Submit At
2023-12-31 15:18:37
Judged At
2024-10-03 14:05:34
Judged By
Score
50
Total Time
≥3097ms
Peak Memory
≥3.133 MiB