/ SeriousOJ /

Record Detail

Time Exceeded


  
# Status Time Cost Memory Cost
#1 Accepted 1ms 284.0 KiB
#2 Accepted 48ms 548.0 KiB
#3 Time Exceeded ≥1869ms ≥540.0 KiB

Code

#include<iostream>
using namespace std;
int main(){
    int t;
    cin>>t;
    while(t--){
        int n,m,flag=1,l;
        cin>>n>>m;
        if(n<m){
            l=n;
        }
        else{
            l=m;
        }
        for(int i=2 ;i<=l; i++){
            if(n%i==0 && m%i==0){
                cout<<i<<endl;
                flag=0;
                break;
            }
        }
        if(flag){
            cout<<-1<<endl;
        }
    }
return 0;
}

Information

Submit By
Type
Submission
Problem
P1011 LCD
Language
C++20 (G++ 13.2.0)
Submit At
2024-01-01 16:17:30
Judged At
2024-01-01 16:17:30
Judged By
Score
50
Total Time
≥1869ms
Peak Memory
≥548.0 KiB