Educational Codeforces Round 86 (Rated for Div. 2) D. Multiple Testcases(思维)

#include
using namespace std;
#define debug puts("YES");
#define rep(x,y,z) for(int (x)=(y);(x)<(z);(x)++)
#define ll long long
#define lrt int l,int r,int rt
#define lson l,mid,rt<<1
#define rson mid+1,r,rt<<1|1
#define mst(a,b) memset((a),(b),sizeof(a))
#define pii pair
#define fi first                                  
#define se second
#define mk(x,y) make_pair(x,y)
const int mod=1e9+7;
const int maxn=2e5+10;
const int maxm=5e5+10;
const ll INF=1e18;
ll powmod(ll x,ll y){ll t; for(t=1;y;y>>=1,x=x*x%mod) if(y&1) t=t*x%mod; return t;}
ll gcd(ll x,ll y){
    if(y==0) return x;
    return gcd(y,x%y);
}
int n,k,ans=0;
int a[maxn],b[maxn],cnt[maxn];
vector ret[maxn];
int main(){
    ios::sync_with_stdio(false);
    cin>>n>>k;
    rep(i,0,n){
        cin>>a[i];
        cnt[a[i]]++;
    }
    sort(a,a+n);
    for(int i=k;i>=1;i--) cnt[i]+=cnt[i+1];
    rep(i,1,k+1){
        cin>>b[i];
        ans=max(ans,cnt[i]/b[i]+((cnt[i]%b[i])!=0));
    }
    rep(i,0,n) ret[i%ans].push_back(a[i]);
    cout<

 

你可能感兴趣的:(Codeforces习题集,构造方法/思维脑洞)