A
#include
using namespace std;
typedef long long ll;
typedef pair<long long,long long> pll;
template<class T>inline void rd(T &x){x=0;char o,f=1;while(o=getchar(),o<48)if(o==45)f=-f;do x=(x<<3)+(x<<1)+(o^48);while(o=getchar(),o>47);x*=f;}
const int inf=~0u>>2; //1073741823
const ll INF=~0ull>>2;//4611686018427387903
const int maxn=1e3+10;
ll judge(ll a,ll b,ll c,ll d,ll e,ll f)
{
ll sum=0;
ll num=min(a,d);
sum+=e*num;
num=min(min(b,c),min(c,d-num));
sum+=f*num;
return sum;
}
ll judge2(ll a,ll b,ll c,ll d,ll e,ll f)
{
ll sum=0;
ll num=min(min(b,c),min(c,d-num));
sum+=f*num;
num=min(a,d-num);
sum+=e*num;
return sum;
}
void solve()
{
ll a,b,c,d,e,f;
rd(a),rd(b),rd(c),rd(d),rd(e),rd(f);
printf("%lld\n",max(judge(a,b,c,d,e,f),judge2(a,b,c,d,e,f)));
}
int main()
{
#ifndef ONLINE_JUDGE
freopen("hzh.in","r",stdin);
//freopen("hzh.out","w",stdout);
#endif
/*
ll T;
rd(T);
while(T--)
*/
solve();
return 0;
}
B
#include
using namespace std;
typedef long long ll;
typedef pair<long long,long long> pll;
template<class T>inline void rd(T &x){x=0;char o,f=1;while(o=getchar(),o<48)if(o==45)f=-f;do x=(x<<3)+(x<<1)+(o^48);while(o=getchar(),o>47);x*=f;}
const int inf=~0u>>2; //1073741823
const ll INF=~0ull>>2;//4611686018427387903
const int maxn=1e3+10;
string s;
int n,b=0,w=0,num=0;
vector<int>ans;
void solve()
{
rd(n);
for(int i=0;i<n;i++)
{
char c=getchar();
s+=c;
if(c=='B') b++;
else w++;
}
if(b%2==1&&w%2==1)
{
puts("-1");
return;
}
if(b==0||w==0)
{
puts("0");
return;
}
if(b%2==0)
{
char s1='W',s2='B';
for(int i=0;i<n-1;i++)
{
if(s[i]==s1) continue;
else if(s[i+1]==s1)
{
ans.push_back(i+1);
num++;
swap(s[i],s[i+1]);
}
else
{
ans.push_back(i+1);
num++;
s[i]=s[i+1]=s1;
}
}
}
else
{
char s2='W',s1='B';
for(int i=0;i<n-1;i++)
{
if(s[i]==s1) continue;
else if(s[i+1]==s1)
{
ans.push_back(i+1);
num++;
swap(s[i],s[i+1]);
}
else
{
ans.push_back(i+1);
num++;
s[i]=s[i+1]=s1;
}
}
}
int len=ans.size();
printf("%d\n",len);
for(int i=0;i<len;i++) printf("%d ",ans[i]);
}
int main()
{
#ifndef ONLINE_JUDGE
freopen("hzh.in","r",stdin);
//freopen("hzh.out","w",stdout);
#endif
/*
ll T;
rd(T);
while(T--)
*/
solve();
return 0;
}
C
#include
using namespace std;
typedef long long ll;
typedef pair<long long,long long> pll;
template<class T>inline void rd(T &x){x=0;char o,f=1;while(o=getchar(),o<48)if(o==45)f=-f;do x=(x<<3)+(x<<1)+(o^48);while(o=getchar(),o>47);x*=f;}
const int inf=~0u>>2; //1073741823
const ll INF=~0ull>>2;//4611686018427387903
const int maxn=1e3+10;
int n,sx,sy,x,y,ansx,ansy,maxx,u,d,l,r;
void solve()
{
rd(n),rd(sx),rd(sy);
while(n--)
{
rd(x),rd(y);
if(x>sx) r++;if(x<sx) l++;
if(y>sy) u++;if(y<sy) d++;
}
if(l>=r&&l>=u&&l>=d)
{
maxx=l;
ansx=sx-1;
ansy=sy;
}
else if(r>=l&&r>=u&&r>=d)
{
maxx=r;
ansx=sx+1;
ansy=sy;
}
else if(u>=l&&u>=r&&u>=d)
{
maxx=u;
ansx=sx;
ansy=sy+1;
}
else if(d>=l&&d>=r&&d>=u)
{
maxx=d;
ansx=sx;
ansy=sy-1;
}
printf("%d\n%d %d\n",maxx,ansx,ansy);
}
int main()
{
#ifndef ONLINE_JUDGE
freopen("stdin.in","r",stdin);
//freopen("stdout.out","w",stdout);
#endif
/*
ll T;
rd(T);
while(T--)
*/
solve();
return 0;
}