/ SeriousOJ /

Record Detail

Time Exceeded


  
# Status Time Cost Memory Cost
#1 Time Exceeded ≥600ms ≥1.516 MiB
#2 Time Exceeded ≥600ms ≥1.676 MiB

Code

#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define testCase ll t; cin >> t; while (t--)
#define Iread ll n; cin >> n; for (ll i = 0; i < n; i++)
#define loop(n) for (ll i = 0; i < n; i++)
#define dbloop(n, m)  for (ll i = 0; i < n; ++i) for (ll j = 0; j < m; ++j)
#define dloop(n) for (ll i = 0, j = n - 1; i < j; ++i, --j)
#define arr(n) ll arr[n]
#define vi vector<ll>
#define ain(arr, n) for (ll i = 0; i < n; ++i) {cin >> arr[i]; }
#define vin(v) for (auto& i : v) cin >> i;
#define prnt(n) for (const auto& i : n) { cout << i << " "; } cout << "\n";
#define endl "\n"

int main() {
#ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#endif
//start
    testCase {
        ll x,y; cin >> x >> y; 
        ll ans = -1; 
        for (ll i = 1; i <= 100; i++) {
            if (i % x != 0 && i % y != 0) ans = i; 
        }
        (ans == -1) ? cout << "-1\n" : cout << ans << endl; 
    }
}

Information

Submit By
Type
Submission
Problem
P1235 A. Valid Integer
Contest
Happy New Year 2026
Language
C++17 (G++ 13.2.0)
Submit At
2026-01-06 14:38:32
Judged At
2026-01-06 14:38:33
Judged By
Score
0
Total Time
≥600ms
Peak Memory
≥1.676 MiB