Submission #391282

# Submission time Handle Problem Language Result Execution time Memory
391282 2021-04-18T12:12:36 Z MrRobot_28 Euklid (COCI20_euklid) C++17
0 / 110
1000 ms 204 KB
#include<bits/stdc++.h>
using namespace std;
#define X first
#define Y second
#define sz(a) (int)a.size()
#define ll long long
#define int long long
#define ld long double
const int N = 3e5 + 100;
int f(int a, int b)
{
    if(a < b)
    {
        return f(b, a);
    }
    if(b == 1)
    {
        return a;
    }
    return f(a / b, b);
}
signed main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    int t;
    cin >> t;
    while(t--)
    {
        int g, h;
        cin >> g >> h;
        int a1, b1;
        for(int a = 1; a <= 1000; a++)
        {
            for(int b = 1; b <= 1000; b++)
            {
                if(__gcd(a, b) == g &&f(a, b) == h)
                {
                    a1 = a;
                    b1= b;
                }
            }
        }
        cout << a1 << " " << b1 << "\n";
    }
    return 0;
}
# Verdict Execution time Memory Grader output
1 Execution timed out 1075 ms 204 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1086 ms 204 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1085 ms 204 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1086 ms 204 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1086 ms 204 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1075 ms 204 KB Time limit exceeded
2 Halted 0 ms 0 KB -