daily 1
2023/5/31
daily codeforces
加载过慢请开启缓存,浏览器默认开启
CF 710E
void solve(){
ll n,x,y;
cin>>n>>x>>y;
vector<ll>dp(n+1,INF);
dp[1]=x;
for(int i=2;i<=n;++i){
if(i%2==0){
dp[i]=min(dp[i],dp[i/2]+y);
}else{
dp[i]=min(dp[(i+1)>>1]+x+y,dp[i]);
}
dp[i]=min(dp[i-1]+x,dp[i]);
}
cout<<dp[n]<<'\n';
return;
}
CF 1833C
solve()
{
cin>>n;
for(int i=1;i<=n;i++) cin>>w[i];
sort(w+1,w+n+1);
if(w[1]%2) cout<<"YES"<<endl;
else{
for(int i=1;i<=n;i++)
if(w[i]%2){
cout<<"NO"<<endl;
return ;
}
cout<<"YES"<<endl;
}
}
CF 1833A
void solve()
{
cin>>n>>m;
for(int i=1;i<=n;i++) c[i] = i;
for(int i=1;i<=n;i++) cin>>a[i];
for(int i=1;i<=n;i++) cin>>b[i];
sort(c+1, c+n+1,[&](int x, int y){
return a[x]<a[y];
});
sort(b+1, b+n+1);
for(int i=1;i<=n;i++) res[c[i]] = b[i];
for(int i=1;i<=n;i++) cout<<res[i]<<" ";
cout<<endl;
}