92分 MLE #4求解
查看原帖
92分 MLE #4求解
1153491
leisure_li楼主2024/10/17 15:34
#include<bits/stdc++.h>
using namespace std;
#define ll long long
int k,n;
ll s[101];
priority_queue<ll,vector<ll>,greater<ll>> h;
int main(){
    cin>>k>>n;
    for(int i=0;i<k;i++){
        cin>>s[i];
        h.push(s[i]);
    }
    ll t=0,m=0;
    while(t<n){
        ll j=h.top();
        h.pop();
        if(j==m) continue;//判重
        else m=j;
        for(int i=0;i<k;i++) h.push(m*s[i]);
        t++;
    }
    cout<<m;
    return 0;
}
2024/10/17 15:34
加载中...