Submission #374334

#TimeUsernameProblemLanguageResultExecution timeMemory
374334VEGAnnEuklid (COCI20_euklid)C++14
15 / 110
1108 ms118924 KiB
#include <bits/stdc++.h> using namespace std; typedef long double ld; typedef long long ll; const ld E = 1e-9; const int N = 5010; 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 <= 5000; i++) for (int j = i; j <= 5000; 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 timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...