답안 #374330

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
374330 2021-03-07T07:48:09 Z VEGAnn Euklid (COCI20_euklid) C++14
15 / 110
1000 ms 492 KB
#include <bits/stdc++.h>
using namespace std;
typedef long double ld;
typedef long long ll;
const ld E = 1e-9;
const int N = 1010;
ll h, g;

ll R(ll a, ll b){
    if (b > a)
        return R(b, a);

    if (b == 1) return a;

    return R(a / b, b);
}

int main(){
    ios_base::sync_with_stdio(0); cin.tie(0);

#ifdef _LOCAL
    freopen("in.txt","r",stdin);
#endif // _LOCAL

    int qq; cin >> qq;

    for (; qq; qq--){
        cin >> g >> h;

        bool was = 0;

        for (int i = 1; i <= 2000 && !was; i++)
        for (int j = 1; j <= 2000 && !was; j++)
            if (__gcd(i, j) == g && R(i, j) == h){
                cout << i << " " << j << '\n';
                was = 1;
                break;
            }

//        for (ll i = g; ; i += g){
//        for (ll i = 1; ; i++){
//            if (R(i, g) == h){
//                cout << g << " " << i << '\n';
//                break;
//            }
//        }
    }

    return 0;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 37 ms 364 KB Output is correct
2 Execution timed out 1098 ms 364 KB Time limit exceeded
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 39 ms 364 KB Output is correct
2 Correct 288 ms 364 KB Output is correct
3 Execution timed out 1090 ms 364 KB Time limit exceeded
4 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 1092 ms 364 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 10 ms 364 KB Output is correct
2 Correct 18 ms 364 KB Output is correct
3 Correct 20 ms 492 KB Output is correct
4 Correct 22 ms 364 KB Output is correct
5 Correct 25 ms 364 KB Output is correct
6 Correct 30 ms 364 KB Output is correct
7 Correct 36 ms 364 KB Output is correct
8 Correct 44 ms 364 KB Output is correct
9 Correct 50 ms 364 KB Output is correct
10 Correct 64 ms 364 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 10 ms 364 KB Output is correct
2 Correct 18 ms 364 KB Output is correct
3 Correct 20 ms 492 KB Output is correct
4 Correct 22 ms 364 KB Output is correct
5 Correct 25 ms 364 KB Output is correct
6 Correct 30 ms 364 KB Output is correct
7 Correct 36 ms 364 KB Output is correct
8 Correct 44 ms 364 KB Output is correct
9 Correct 50 ms 364 KB Output is correct
10 Correct 64 ms 364 KB Output is correct
11 Execution timed out 1077 ms 364 KB Time limit exceeded
12 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 37 ms 364 KB Output is correct
2 Execution timed out 1098 ms 364 KB Time limit exceeded
3 Halted 0 ms 0 KB -