/ SeriousOJ /

Record Detail

Time Exceeded


  
# Status Time Cost Memory Cost
#1 Accepted 2ms 484.0 KiB
#2 Accepted 80ms 564.0 KiB
#3 Time Exceeded ≥3012ms ≥540.0 KiB

Code

#include<iostream>
using namespace std;

int main()
{
    int t;
    cin >> t;
    while(t--)
    {
        int n,m,i,x,ctr=0;
        cin >> n >> m;
        if(n>m)
            x=n;
        else
            x=m;
        for(i=2; i<=x/2; i++)
        {
            if(n%i==0 && m%i==0)
            {
                ctr++;
                break;
            }
        }
        if(ctr==0)
            cout << -1 << endl;
        else
            cout << i << endl;
    }
    return 0;
}

Information

Submit By
Type
Submission
Problem
P1011 LCD
Language
C++20 (G++ 13.2.0)
Submit At
2024-05-02 13:33:49
Judged At
2024-11-11 03:36:02
Judged By
Score
50
Total Time
≥3012ms
Peak Memory
≥564.0 KiB