/ SeriousOJ /

Record Detail

Time Exceeded


  
# Status Time Cost Memory Cost
#1 Accepted 1ms 336.0 KiB
#2 Accepted 146ms 456.0 KiB
#3 Time Exceeded ≥3023ms ≥420.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-11-11 03:46:07
Judged By
Score
50
Total Time
≥3023ms
Peak Memory
≥456.0 KiB