Submission #374333

# Submission time Handle Problem Language Result Execution time Memory
374333 2021-03-07T07:50:56 Z VEGAnn Euklid (COCI20_euklid) C++14
15 / 110
314 ms 34060 KB
#include <bits/stdc++.h>
using namespace std;
typedef long double ld;
typedef long long ll;
const ld E = 1e-9;
const int N = 2010;
ll h, g;
int mem[N][N][2];

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

    for (int i = 1; i <= 2000; i++)
        for (int j = 1; j <= 2000; j++) {
            int fi = __gcd(i, j);
            int se = R(i, j);

            if (fi >= N || se >= N) continue;

            mem[fi][se][0] = i;
            mem[fi][se][1] = j;
        }

    int qq; cin >> qq;

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

        cout << mem[g][h][0] << " " << mem[g][h][1] << '\n';
    }

    return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 266 ms 16872 KB Output is correct
2 Runtime error 303 ms 33824 KB Execution killed with signal 11
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 272 ms 16924 KB Output is correct
2 Correct 263 ms 16748 KB Output is correct
3 Runtime error 314 ms 34060 KB Execution killed with signal 11
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 265 ms 16748 KB Integer parameter [name=a] equals to 0, violates the range [1, 10^18]
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 265 ms 16864 KB Output is correct
2 Correct 269 ms 16876 KB Output is correct
3 Correct 265 ms 17004 KB Output is correct
4 Correct 271 ms 16748 KB Output is correct
5 Correct 268 ms 16748 KB Output is correct
6 Correct 264 ms 16748 KB Output is correct
7 Correct 285 ms 16748 KB Output is correct
8 Correct 266 ms 16748 KB Output is correct
9 Correct 278 ms 16724 KB Output is correct
10 Correct 263 ms 16748 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 265 ms 16864 KB Output is correct
2 Correct 269 ms 16876 KB Output is correct
3 Correct 265 ms 17004 KB Output is correct
4 Correct 271 ms 16748 KB Output is correct
5 Correct 268 ms 16748 KB Output is correct
6 Correct 264 ms 16748 KB Output is correct
7 Correct 285 ms 16748 KB Output is correct
8 Correct 266 ms 16748 KB Output is correct
9 Correct 278 ms 16724 KB Output is correct
10 Correct 263 ms 16748 KB Output is correct
11 Incorrect 266 ms 16876 KB Integer parameter [name=a] equals to 0, violates the range [1, 10^18]
12 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 266 ms 16872 KB Output is correct
2 Runtime error 303 ms 33824 KB Execution killed with signal 11
3 Halted 0 ms 0 KB -