题目链接:http://codeforces.com/contest/1155
#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 root l,r,rt
#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=5e2+10;
const int ub=1e6;
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;}
int gcd(int x,int y){
if(y==0) return x;
return gcd(y,x%y);
}
string s;
int n;
int main(){
cin>>n>>s;
int flag=0,l,r;
///int len=s.size();
for(int i=0;is[i+1]){
l=i,r=i+1;
flag=1;
break;
}
}
if(flag==0) puts("NO");
else {
puts("YES");
cout<
#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 root l,r,rt
#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=5e2+10;
const int ub=1e6;
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;}
int gcd(int x,int y){
if(y==0) return x;
return gcd(y,x%y);
}
int flag=0,n;
string s;
int main(){
cin>>n>>s;
int cnt=(n-11)/2,stp=cnt;
for(int i=0;istp) isw=0;
break;
}
}
if(isw) puts("YES");
else puts("NO");
}
return 0;
}
#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 root l,r,rt
#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=3e5+10;
const int ub=1e6;
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);
}
ll n,m;
ll a[maxn],b[maxn];
int main(){
cin>>n>>m;
ll gd=0;
rep(i,0,n){
cin>>a[i];
///gd1=gcd(gd1,a[i]);
if(i) gd=gcd(gd,a[i]-a[i-1]);
}
int flag=0,res=0,pos=0;
rep(i,0,m){
cin>>b[i];
if(gd%b[i]==0){
flag=1;
res=i+1;
pos=a[0];
}
}
if(flag){
puts("YES");
cout<
#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 root l,r,rt
#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=3e5+100;
const int ub=1e6;
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);
}
ll n,x,k;
ll dp[maxn][3];
int main(){
cin>>n>>k;
mst(dp,0);
ll ans=0;
rep(i,1,n+1){
cin>>x;
dp[i][0]=dp[i-1][0]+x;
dp[i][0]=max(dp[i][0],0LL);
dp[i][1]=max(dp[i-1][1],dp[i-1][0])+x*k;
dp[i][1]=max(dp[i][1],0LL);
dp[i][2]=max(dp[i-1][1],dp[i-1][2])+x;
dp[i][2]=max(dp[i][2],0LL);
ans=max(ans,max(dp[i][2],max(dp[i][0],dp[i][1])));
}
cout<