比赛 2024暑期C班集训3 评测结果 AAWWWWWWWWWWWWWWWWWW
题目名称 挑战 NPH 最终得分 10
用户昵称 ┭┮﹏┭┮ 运行时间 0.002 s
代码语言 C++ 内存使用 2.13 MiB
提交时间 2024-07-03 11:23:21
显示代码纯文本
#include <bits/stdc++.h> 
using namespace std;
#define ll long long
#define pii pair<ll,ll>
#define mp make_pair
#define in inline
#define re register
const int N = 1e3+10;
const ll mod = 1e9+7;


in ll read(){
   ll x = 0,f = 1;char c = getchar();
   for(;c < '0' || c > '9';c = getchar())if(c == '-')f = -1;
   for(;c >= '0' && c <= '9';c = getchar())x = (x<<1) + (x<<3) + c-'0';
   return x * f;
}


int t,n,len;ll k;
ll a[N],b[N],cnt[N];


ll f[N][N],g[N][N];
void solve2(){
    for(int i = 0;i <= 10;i++)f[0][i] = 1,g[0][i] = g[0][i-1] + 1;
    for(int i = 1;i <= n;i++){
        for(int j = 1;j <= 10;j++){
            f[i][j] += g[i-1][j];
            g[i][j] = g[i][j-1] + f[i][j];
//            for(int k = 0;k <= j;k++)f[i][j] += f[i-1][k];
        }
    }
    for(int i = 1;i <= 10;i++)cout<<f[n][i]<<' ';
    for(int i = 1;i <= 10;i++){
        if(k <= f[n][i])return printf("%d\n",i),void();
        else k -= f[n][i];
    }
        
}
void solve(){
    memset(b,0,sizeof b);
    memset(cnt,0,sizeof cnt);len = 0;
    n = read(),k = read();bool f = 1;
    for(int i = 1;i <= n;i++)a[i] = read(),f |= a[i] == 1;
    if(n == 1)return printf("%lld\n",a[1] * k),void();
    else if(f)return solve2(),void();
    sort(a+1,a+1+n);
    b[++len] = a[1];cnt[len] = 1;
    for(int i = 1;i < n;i++){
        if(a[i] != a[i+1])b[++len] = a[i+1],cnt[len]++;
        else cnt[len]++;
    }
    
}
int main(){
    freopen("NPH.in","r",stdin);
    freopen("NPH.out","w",stdout);
    t = read();
    while(t--){
        solve();
    }
    
    
    
    return cerr<<clock()<<"ms"<<endl,0;
}