Time Exceeded
Code
T = int(input())
query = []
report = []
for _ in range(T):
N, M = map(int, input().split())
query.append([N, M])
for N, M in query:
sign = True
for i in range(2, max(N, M)+1):
if N % i == 0 and M % i == 0:
report.append(i)
sign = False
break
if sign:
report.append(-1)
[print(i) for i in report]
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:08:05
- Judged At
- 2024-11-11 03:45:57
- Judged By
- Score
- 50
- Total Time
- ≥3087ms
- Peak Memory
- ≥4.992 MiB