# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
374415 |
2021-03-07T09:27:57 Z |
topovik |
Euklid (COCI20_euklid) |
C++14 |
|
368 ms |
71404 KB |
#include <bits/stdc++.h>
#define f first
#define s second
#define pb push_back
using namespace std;
typedef long long ll;
typedef long double ld;
const ll N = 3e3 + 10;
const ll oo = 1e10;
int gcd[N][N], val[N][N];
int f(int x, int y)
{
if (y > x) swap(x, y);
if (val[x][y] != 0) return val[x][y];
if (y == 1) return val[x][y] = x;
else return val[x][y] = f(x / y, y);
}
int gd(int x, int y)
{
if (x < y) swap(x, y);
if (y == 0) return x;
if (gcd[x][y] != 0) return gcd[x][y];
return val[x][y] = gd(x % y, y);
}
int main()
{
int t;
cin >> t;
for (int i = 1; i < N; i++)
for (int j = 1; j < N; j++) gcd[i][j] = gd(i, j), val[i][j] = f(i, j);
while (t--)
{
int x, y;
cin >> x >> y;
int l = -1, r = -1;
for (int i = 1; i <= 1000; i++)
for (int j = 1; j <= 1000; j++)
if (gcd[i][j] == x && val[i][j] == y) l = i, r = j;
cout << l << " " << r << endl;
}
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
354 ms |
71404 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
344 ms |
71404 KB |
Integer parameter [name=a] equals to -1, violates the range [1, 10^18] |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
341 ms |
71216 KB |
Integer parameter [name=a] equals to -1, violates the range [1, 10^18] |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
368 ms |
71188 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
368 ms |
71188 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
354 ms |
71404 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |