Submission #473961

# Submission time Handle Problem Language Result Execution time Memory
473961 2021-09-16T12:56:01 Z Mr_Ph Euklid (COCI20_euklid) C++14
35 / 110
1000 ms 312 KB
///made by : Mr_Ph :D
#include<bits/stdc++.h>
#include<unordered_map>
typedef long long ll;
typedef long long int lli;
typedef unsigned long long ull;
using namespace std;
const double PI=acos(-1.0);
const ll mod=(ll)1e9+7;
//int dx[4] = {0, 0, 1, -1};
//int dy[4] = {1, -1, 0, 0};
///the defines :)
#define endl '\n'
#define vi vector<int>
#define vll vector<ll>
#define lower(s) transform(s.begin(),s.end(),s.begin(),::tolower)
#define upper(s) transform(s.begin(),s.end(),s.begin(),::toupper)
#define ent(arr) for(int i=0;i<arr.size();i++)cin>>arr[i];
#define all(arr) arr.begin(),arr.end()
#define allr(arr) arr.rbegin(),arr.rend()
#define sz size()
///the end of the defines ;)
ll R(ll a,ll b)
{
    if(a<b)
        return R(b,a);
    if(a>=b&&b>1)
        return R(a/b,b);
    if(a>=b&&b==1)
        return a;
}
void solve()
{
    ll a,b;
    cin>>a>>b;
    if(b==2)
    {
        cout<<a*2<<" "<<a<<endl;
        return;
    }
    else if(a==b*b)
    {
        cout<<a*b<<" "<<a<<endl;
        return;
    }
    else if(a==b)
    {
        cout<<a<<" "<<b<<endl;
        return;
    }
    else
    {
        for(ll i=1; i<=2000; i++)
        {
            for(ll k=1; k<=2000; k++)
            {
                if(__gcd(i,k)==a&&R(i,k)==b)
                {
                    cout<<i<<" "<<k<<endl;
                    return;
                }
            }
        }
    }
}
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(0);
    //freopen("window.in","r",stdin);
    //freopen("output.txt","w",stdout);
    int t=1;//int st;
    cin>>t;//cin>>st;
    while(t--)
        solve();
}

Compilation message

euklid.cpp: In function 'll R(ll, ll)':
euklid.cpp:31:1: warning: control reaches end of non-void function [-Wreturn-type]
   31 | }
      | ^
# Verdict Execution time Memory Grader output
1 Correct 1 ms 204 KB Output is correct
2 Correct 0 ms 204 KB Output is correct
3 Correct 0 ms 204 KB Output is correct
4 Correct 0 ms 204 KB Output is correct
5 Correct 0 ms 204 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 204 KB Output is correct
2 Correct 0 ms 204 KB Output is correct
3 Correct 0 ms 204 KB Output is correct
4 Correct 0 ms 204 KB Output is correct
5 Correct 0 ms 204 KB Output is correct
6 Correct 0 ms 204 KB Output is correct
7 Correct 0 ms 204 KB Output is correct
8 Correct 0 ms 204 KB Output is correct
9 Correct 0 ms 204 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 204 KB Output is correct
2 Correct 0 ms 204 KB Output is correct
3 Correct 0 ms 204 KB Output is correct
4 Correct 0 ms 204 KB Output is correct
5 Correct 0 ms 204 KB Output is correct
6 Correct 0 ms 204 KB Output is correct
7 Correct 0 ms 204 KB Output is correct
8 Correct 0 ms 204 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 11 ms 304 KB Output is correct
2 Correct 19 ms 256 KB Output is correct
3 Correct 20 ms 204 KB Output is correct
4 Correct 24 ms 312 KB Output is correct
5 Correct 26 ms 204 KB Output is correct
6 Correct 31 ms 288 KB Output is correct
7 Correct 39 ms 288 KB Output is correct
8 Correct 46 ms 204 KB Output is correct
9 Correct 54 ms 204 KB Output is correct
10 Correct 69 ms 204 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 11 ms 304 KB Output is correct
2 Correct 19 ms 256 KB Output is correct
3 Correct 20 ms 204 KB Output is correct
4 Correct 24 ms 312 KB Output is correct
5 Correct 26 ms 204 KB Output is correct
6 Correct 31 ms 288 KB Output is correct
7 Correct 39 ms 288 KB Output is correct
8 Correct 46 ms 204 KB Output is correct
9 Correct 54 ms 204 KB Output is correct
10 Correct 69 ms 204 KB Output is correct
11 Execution timed out 1085 ms 204 KB Time limit exceeded
12 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 204 KB Output is correct
2 Correct 0 ms 204 KB Output is correct
3 Correct 0 ms 204 KB Output is correct
4 Correct 0 ms 204 KB Output is correct
5 Correct 0 ms 204 KB Output is correct
6 Correct 1 ms 204 KB Output is correct
7 Correct 0 ms 204 KB Output is correct
8 Correct 0 ms 204 KB Output is correct
9 Correct 0 ms 204 KB Output is correct
10 Correct 0 ms 204 KB Output is correct
11 Correct 0 ms 204 KB Output is correct
12 Correct 0 ms 204 KB Output is correct
13 Correct 0 ms 204 KB Output is correct
14 Correct 0 ms 204 KB Output is correct
15 Correct 1 ms 204 KB Output is correct
16 Correct 0 ms 204 KB Output is correct
17 Correct 0 ms 204 KB Output is correct
18 Correct 0 ms 204 KB Output is correct
19 Correct 0 ms 204 KB Output is correct
20 Correct 0 ms 204 KB Output is correct
21 Correct 0 ms 204 KB Output is correct
22 Correct 0 ms 204 KB Output is correct
23 Correct 11 ms 304 KB Output is correct
24 Correct 19 ms 256 KB Output is correct
25 Correct 20 ms 204 KB Output is correct
26 Correct 24 ms 312 KB Output is correct
27 Correct 26 ms 204 KB Output is correct
28 Correct 31 ms 288 KB Output is correct
29 Correct 39 ms 288 KB Output is correct
30 Correct 46 ms 204 KB Output is correct
31 Correct 54 ms 204 KB Output is correct
32 Correct 69 ms 204 KB Output is correct
33 Execution timed out 1085 ms 204 KB Time limit exceeded
34 Halted 0 ms 0 KB -