/ SeriousOJ /

Record Detail

Time Exceeded


  
# Status Time Cost Memory Cost
#1 Accepted 1ms 324.0 KiB
#2 Accepted 57ms 564.0 KiB
#3 Time Exceeded ≥3059ms ≥536.0 KiB

Code

#include<iostream>
#include<bits/stdc++.h>
using namespace std;
#define ll long long int


void solve(){
    int n, m;
    cin>>n>>m;

    int mn = min(n, m);

    for(int i=2;i<=mn;i++){
        if(n%i==0 && m%i==0){
            cout<<i<<endl;
            return;
        }
    }

    cout<<-1<<endl;
}

int main(){

    int t;
    cin>>t;
    while(t--){
        solve();
    }

    return 0;
}

Information

Submit By
Type
Submission
Problem
P1011 LCD
Contest
Brain booster - 1
Language
C++17 (G++ 13.2.0)
Submit At
2023-12-31 15:08:44
Judged At
2024-11-11 03:45:57
Judged By
Score
50
Total Time
≥3059ms
Peak Memory
≥564.0 KiB