Submission #332192

# Submission time Handle Problem Language Result Execution time Memory
332192 2020-12-01T16:02:20 Z DanerZein Euklid (COCI20_euklid) C++14
15 / 110
1000 ms 492 KB
#include <bits/stdc++.h>
using namespace std;
int gcd(int a,int b){
  if(b==0) return a;
  return gcd(b,a%b);
}
int R(int a,int b){
  if(b>a) swap(a,b);
  if(b==1) return a;
  if(a==1) return b;
  return R(a/b,b);
}
int main(){
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  int t;
  cin>>t;
  while(t--){
    int g,h;
    cin>>g>>h;
    bool sw=0;
    for(int i=1;i<=10000;i++){
      for(int j=1;j<=10000;j++){
	if(R(i,j)==h && g==gcd(i,j)){
	  cout<<i<<" "<<j<<endl;
	  sw=1;
	  break;
	}
      }
      if(sw) break;
    }
  }
}
# Verdict Execution time Memory Grader output
1 Correct 238 ms 364 KB Output is correct
2 Execution timed out 1086 ms 364 KB Time limit exceeded
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 330 ms 364 KB Output is correct
2 Execution timed out 1092 ms 364 KB Time limit exceeded
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1057 ms 364 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 68 ms 364 KB Output is correct
2 Correct 145 ms 364 KB Output is correct
3 Correct 162 ms 364 KB Output is correct
4 Correct 179 ms 364 KB Output is correct
5 Correct 188 ms 364 KB Output is correct
6 Correct 212 ms 364 KB Output is correct
7 Correct 240 ms 364 KB Output is correct
8 Correct 285 ms 384 KB Output is correct
9 Correct 310 ms 364 KB Output is correct
10 Correct 349 ms 364 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 68 ms 364 KB Output is correct
2 Correct 145 ms 364 KB Output is correct
3 Correct 162 ms 364 KB Output is correct
4 Correct 179 ms 364 KB Output is correct
5 Correct 188 ms 364 KB Output is correct
6 Correct 212 ms 364 KB Output is correct
7 Correct 240 ms 364 KB Output is correct
8 Correct 285 ms 384 KB Output is correct
9 Correct 310 ms 364 KB Output is correct
10 Correct 349 ms 364 KB Output is correct
11 Execution timed out 1092 ms 492 KB Time limit exceeded
12 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 238 ms 364 KB Output is correct
2 Execution timed out 1086 ms 364 KB Time limit exceeded
3 Halted 0 ms 0 KB -