#include <bits/stdc++.h>
#include<stdio.h>
#include<memory.h>
#include<limits.h>
#include<string.h>
using namespace std;
struct Node {
int i,j;
float val;
Node(int ii,int jj,float v) : i(ii), j(jj), val(v) {};
};
bool cmp(Node &a,Node &b) {
if (a.val < b.val) return true;
return false;
}
vector<int> solve(vector<int>&nums,int k) {
vector<int> ans;
int n=nums.size();
vector<Node> temp;
for(int i=0;i<n;i++) {
for(int j=i+1;j<n;j++) {
temp.push_back(Node(nums[i],nums[j],1.0*nums[i]/nums[j]));
}
}
sort(temp.begin(),temp.end(),cmp);
ans.push_back(temp[k-1].i);
ans.push_back(temp[k-1].j);
return ans;
}
int main() {
vector<int> nums = {1,2,3,5};
int k=3;
auto ans = solve(nums,3);
cout<<ans[0]<<" "<<ans[1]<<endl;
}
I2luY2x1ZGUgPGJpdHMvc3RkYysrLmg+CiNpbmNsdWRlPHN0ZGlvLmg+CiNpbmNsdWRlPG1lbW9yeS5oPgojaW5jbHVkZTxsaW1pdHMuaD4KI2luY2x1ZGU8c3RyaW5nLmg+CnVzaW5nIG5hbWVzcGFjZSBzdGQ7CgpzdHJ1Y3QgTm9kZSB7CglpbnQgaSxqOwoJZmxvYXQgdmFsOwoJTm9kZShpbnQgaWksaW50IGpqLGZsb2F0IHYpIDogaShpaSksIGooamopLCB2YWwodikge307Cn07Cgpib29sIGNtcChOb2RlICZhLE5vZGUgJmIpIHsKCWlmIChhLnZhbCA8IGIudmFsKSByZXR1cm4gdHJ1ZTsKCXJldHVybiBmYWxzZTsKfQogCnZlY3RvcjxpbnQ+IHNvbHZlKHZlY3RvcjxpbnQ+Jm51bXMsaW50IGspIHsKCXZlY3RvcjxpbnQ+IGFuczsKCWludCBuPW51bXMuc2l6ZSgpOwoJdmVjdG9yPE5vZGU+IHRlbXA7CgkKCQoJZm9yKGludCBpPTA7aTxuO2krKykgewoJCWZvcihpbnQgaj1pKzE7ajxuO2orKykgewoJCQl0ZW1wLnB1c2hfYmFjayhOb2RlKG51bXNbaV0sbnVtc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