# Dashboard - Codeforces Global Round 13 - Codeforces

2022-08-06 12:45:24  阅读：18  来源： 互联网

# Dashboard - Codeforces Global Round 13 - Codeforces

## 1.Problem - B - Codeforces

`#include<bits/stdc++.h>using namespace std;#define IOS ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);#define fel(i,x,y) for(int i=x;i<=y;i++)#define fhl(i,x,y) for(int i=x;i>=y;i--)#define inf 0x3fffffff#define ll long long#define pb push_back#define endl "\n"#define int long longconst int N=200;int n,u,v;int a[N];void slove(){    cin>>n>>u>>v;    fel(i,1,n){        cin>>a[i];    }    int cnt=0;    for(int i=2;i<=n;i++){        if(a[i]==a[i-1])cnt++;        else if(abs(a[i]-a[i-1])>1){            cout<<0<<endl;            return;        }    }    if(cnt==n-1){        cout<<min(u+v,v*2)<<endl;    }    else cout<<min(u,v)<<endl;}signed main(){    IOS    int t;    cin>>t;    while(t--){        slove();    }    return 0;}`

## 2.Problem - C - Codeforces

`#include<bits/stdc++.h>using namespace std;#define IOS ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);#define fel(i,x,y) for(int i=x;i<=y;i++)#define fhl(i,x,y) for(int i=x;i>=y;i--)#define inf 0x3fffffff#define ll long long#define pb push_back#define endl "\n"#define int long longconst int N=5e3+100;int a[N],b[N],n;void slove(){    cin>>n;    fel(i,1,n){        cin>>a[i];        b[i]=0;    }    int ans=0;    for(int i=1;i<=n;i++){        int t=b[i];        if(b[i]<a[i]-1){            ans+=a[i]-1-b[i];            t+=a[i]-1-b[i];        }        b[i+1]+=t-a[i]+1;        if(i+2<=n)            for(int j=i+2;j<=min(n,a[i]+i);j++){                b[j]++;            }    }    cout<<ans<<endl;}signed main(){    IOS    int t;    cin>>t;    while(t--){        slove();    }    return 0;}`

## 3.Problem - D - Codeforces

`#include<bits/stdc++.h>using namespace std;#define IOS ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);#define fel(i,x,y) for(int i=x;i<=y;i++)#define fhl(i,x,y) for(int i=x;i>=y;i--)#define inf 0x3fffffff#define ll long long#define pb push_back#define endl "\n"#define int long long//发先每一个数如果加上一个数那我的一只能向更高位进，所以后缀1的个数x肯定是大于y的，//定义f[i,x]是x最1-i位1的个数，想要是x可以变成y，显先必须的满足f[i,x]>=f[i,y];int x,y;int sumx[50],sumy[50];void slove(){    memset(sumx,0,sizeof(sumx));    memset(sumy,0,sizeof(sumy));    cin>>x>>y;    if(x>y){        cout<<"NO"<<endl;        return;    }    for(int i=1;i<=30;i++){        sumx[i]=sumx[i-1];        sumy[i]=sumy[i-1];        if(x&1)sumx[i]++;        if(y&1)sumy[i]++;        x/=2,y/=2;    }    for(int i=1;i<=30;i++){        if(sumx[i]<sumy[i]){            cout<<"NO"<<endl;            return;        }    }    cout<<"YES"<<endl;}signed main(){    IOS    int t;    cin>>t;    while(t--){        slove();    }    return 0;}`

Copyright (C)ICode9.com, All Rights Reserved.

ICode9版权所有