Submission #473820

# Submission time Handle Problem Language Result Execution time Memory
473820 2021-09-16T09:48:02 Z Ahmed_Solyman Euklid (COCI20_euklid) C++14
0 / 110
1000 ms 204 KB
#include <bits/stdc++.h>

using namespace std;

typedef long long ll;

ll R(ll a,ll b){
    if(a>b)return R(b,a);
    if(a>=b>1)return R(a/b,b);
    if(a>=b==1)return a;
}
int main()
{
    ll t;cin>>t;
    while(t--){
        ll g,h;cin>>g>>h;
        for(ll i=0;i<=max(h,g);i++){
            bool b=0;
            for(ll j=0;j<=max(h,g);j++){
                if(__gcd(i,j)==g && R(i,j)==h){
                    b=1;
                    cout<<i<<" "<<j<<endl;break;
                }
            }
            if(b)break;
        }
    }
    return 0;
}

Compilation message

euklid.cpp: In function 'll R(ll, ll)':
euklid.cpp:9:12: warning: comparison of constant '1' with boolean expression is always false [-Wbool-compare]
    9 |     if(a>=b>1)return R(a/b,b);
      |        ~~~~^~
euklid.cpp:9:9: warning: comparisons like 'X<=Y<=Z' do not have their mathematical meaning [-Wparentheses]
    9 |     if(a>=b>1)return R(a/b,b);
      |        ~^~~
euklid.cpp:10:9: warning: suggest parentheses around comparison in operand of '==' [-Wparentheses]
   10 |     if(a>=b==1)return a;
      |        ~^~~
euklid.cpp:11:1: warning: control reaches end of non-void function [-Wreturn-type]
   11 | }
      | ^
# Verdict Execution time Memory Grader output
1 Correct 1 ms 204 KB Output is correct
2 Execution timed out 1085 ms 204 KB Time limit exceeded
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 204 KB Unexpected end of file - int64 expected
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 964 ms 204 KB Unexpected end of file - int64 expected
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 204 KB Unexpected end of file - int64 expected
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 204 KB Unexpected end of file - int64 expected
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 204 KB Output is correct
2 Execution timed out 1085 ms 204 KB Time limit exceeded
3 Halted 0 ms 0 KB -