/ SeriousOJ /

Record Detail

Time Exceeded


  
# Status Time Cost Memory Cost
#1 Accepted 0ms 284.0 KiB
#2 Accepted 104ms 456.0 KiB
#3 Time Exceeded ≥3067ms ≥416.0 KiB

Code

#include <cstdio>
using namespace std;
#define ll long long
void solve()
{
    ll n, m;
    scanf("%lld %lld", &n, &m);
    ll smaller = (n < m) ? n : m;
    for (ll i = 2; i <= smaller; ++i)
    {
        if (n % i == 0 && m % i == 0)
        {
            printf("%lld\n", i);
            return;
        }
    }
    printf("-1\n");
}

int main()
{
    int t;
    scanf("%d", &t);
    while (t--)
        solve();
    return 0;
}

Information

Submit By
Type
Submission
Problem
P1011 LCD
Contest
Brain booster - 1
Language
C++20 (G++ 13.2.0)
Submit At
2023-12-31 14:52:01
Judged At
2024-10-03 14:05:57
Judged By
Score
50
Total Time
≥3067ms
Peak Memory
≥456.0 KiB