Submission #473902

# Submission time Handle Problem Language Result Execution time Memory
473902 2021-09-16T11:46:04 Z Ahmed57 Euklid (COCI20_euklid) C++14
0 / 110
1000 ms 288 KB
#include <bits/stdc++.h>
using namespace std;
long long r(int a,int b){
    if(a<b)return r(b,a);
    else if(a>=b&&b>1)return r(abs(a/b),b);
    else if(a>=b&&b==1)return a;
}
int main(){
    //ios_base::sync_with_stdio(false);cin.tie(NULL);
    int t;cin>>t;
    z:while(t--){
        int a,b;
        cin>>a>>b;
        for(int i = 1;i<1000;i++){
            for(int j = 1;j<1000;j++){
                if(__gcd(i,j)==a&&r(i,j)==b){
                    cout<<i<<" "<<j<<"\n";
                    goto z;
                }
            }
        }
    }
    return 0;
}

Compilation message

euklid.cpp: In function 'long long int r(int, int)':
euklid.cpp:7:1: warning: control reaches end of non-void function [-Wreturn-type]
    7 | }
      | ^
# Verdict Execution time Memory Grader output
1 Correct 21 ms 204 KB Output is correct
2 Execution timed out 1076 ms 204 KB Time limit exceeded
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 20 ms 204 KB Output is correct
2 Correct 158 ms 204 KB Output is correct
3 Execution timed out 1089 ms 204 KB Time limit exceeded
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1057 ms 204 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 6 ms 204 KB Output is correct
2 Correct 10 ms 204 KB Output is correct
3 Correct 10 ms 288 KB Output is correct
4 Correct 12 ms 204 KB Output is correct
5 Correct 13 ms 204 KB Output is correct
6 Correct 15 ms 204 KB Output is correct
7 Correct 19 ms 204 KB Output is correct
8 Correct 23 ms 204 KB Output is correct
9 Correct 27 ms 204 KB Output is correct
10 Incorrect 68 ms 204 KB Output isn't correct
# Verdict Execution time Memory Grader output
1 Correct 6 ms 204 KB Output is correct
2 Correct 10 ms 204 KB Output is correct
3 Correct 10 ms 288 KB Output is correct
4 Correct 12 ms 204 KB Output is correct
5 Correct 13 ms 204 KB Output is correct
6 Correct 15 ms 204 KB Output is correct
7 Correct 19 ms 204 KB Output is correct
8 Correct 23 ms 204 KB Output is correct
9 Correct 27 ms 204 KB Output is correct
10 Incorrect 68 ms 204 KB Output isn't correct
# Verdict Execution time Memory Grader output
1 Correct 21 ms 204 KB Output is correct
2 Execution timed out 1076 ms 204 KB Time limit exceeded
3 Halted 0 ms 0 KB -