/ SeriousOJ /

Record Detail

Accepted


  
# Status Time Cost Memory Cost
#1 Accepted 1ms 344.0 KiB
#2 Accepted 5ms 576.0 KiB
#3 Accepted 5ms 532.0 KiB

Code

#include <bits/stdc++.h>
using namespace std;
using namespace chrono;

vector<string> strings{
        "RGB",
        "GRB",
        "GBR",
        "BGR",
        "BRG",
        "RBG"
};

signed main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    cout.tie(nullptr);

    int t; cin >> t; while (t--) {
        int a,b; cin >> a >> b;
        a = gcd(a, b);
        if (a == 1) {
            cout << "-1\n";
            continue;
        }
        int ans;
        for (ans = 2; ans*ans <= a && a % ans != 0; ans++);
        if (ans*ans > a) ans = a;
        cout << ans << "\n";
    }
}

Information

Submit By
Type
Submission
Problem
P1011 E. LCD
Language
C++17 (G++ 13.2.0)
Submit At
2025-07-14 18:20:41
Judged At
2025-07-14 18:20:41
Judged By
Score
100
Total Time
5ms
Peak Memory
576.0 KiB