样例能过
#include<bits/stdc++.h>
#define int long long
using namespace std;
const int mod=1e9+7;
const int N=3e5+5;
int sum2[N<<2],ACsum2;
int sum3[N<<2],ACsum3;
int num[N<<2],mn[N<<2];
int n,T,op,a,b,d=1;
void build(int k,int l,int r){
if(l==r){
sum2[k]=num[l]*num[l]%mod;
sum3[k]=sum2[k]*num[l]%mod;
mn[k]=num[l];
return;
}
int k1=k<<1,k2=k<<1|1;
int mid=(l+r)/2;
build(k1,l,mid);
build(k2,mid+1,r);
sum2[k]=(sum2[k1]+sum2[k2])%mod;
sum3[k]=(sum3[k1]+sum3[k2])%mod;
mn[k]=min(mn[k1],mn[k2]);
}
int query2(int k,int l,int r,int x,int y){
if(l>=x and r<=y) return sum2[k];
int k1=k<<1,k2=k<<1|1;
int mid=(l+r)/2;
int ans=0;
if(x<=mid) ans=(ans+query2(k1,l,mid,x,y))%mod;
if(y>mid) ans=(ans+query2(k2,mid+1,r,x,y))%mod;
return ans;
}
int query3(int k,int l,int r,int x,int y){
if(l>=x and r<=y) return sum3[k];
int k1=k<<1,k2=k<<1|1;
int mid=(l+r)/2;
int ans=0;
if(x<=mid) ans=(ans+query3(k1,l,mid,x,y))%mod;
if(y>mid) ans=(ans+query3(k2,mid+1,r,x,y))%mod;
return ans;
}
int querymn(int k,int l,int r,int x,int y){
if(l>=x and r<=y) return mn[k];
int k1=k<<1,k2=k<<1|1;
int mid=(l+r)/2;
int ans=LLONG_MAX;
if(x<=mid) ans=min(ans,querymn(k1,l,mid,x,y));
if(y>mid) ans=min(ans,querymn(k2,mid+1,r,x,y));
return ans;
}
void change(int k,int l,int r,int p,int v){
if(l==r){
sum2[k]=v*v%mod;
sum3[k]=sum2[k]*v%mod;
mn[k]=v;
return;
}
int k1=k<<1,k2=k<<1|1;
int mid=(l+r)/2;
if(p<=mid) change(k1,l,mid,p,v);
else change(k2,mid+1,r,p,v);
sum2[k]=(sum2[k1]+sum2[k2])%mod;
sum3[k]=(sum3[k1]+sum3[k2])%mod;
mn[k]=min(mn[k1],mn[k2]);
}
signed main(){
freopen("P3792_1.in","r",stdin);
freopen("shabby.txt","w",stdout);
ios::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
cin>>n>>T;
for(int i=1;i<=n;i++) cin>>num[i];
build(1,1,n);
while(T--){
cin>>op>>a>>b;
if(op==1) change(1,1,n,a,b);
if(op==2){
int s2=query2(1,1,n,a,b);
int s3=query3(1,1,n,a,b);
int a1=querymn(1,1,n,a,b);
ACsum2=( 6*(b-a+1) %mod *a1 %mod *a1 %mod
+6*(b-a+1) %mod *(b-a) %mod *a1 %mod *d %mod
+(b-a+1)*(b-a) %mod *(2*b-2*a+1) %mod *d %mod *d %mod )%mod;
ACsum3=( 4*(b-a+1) %mod *a1 %mod *a1 %mod *a1 %mod
+6*a1 %mod *a1 %mod *d %mod *(b-a+1) %mod *(b-a) %mod
+2*a1 %mod *d %mod *d %mod *(b-a+1) %mod *(b-a) %mod *(2*b-2*a+1) %mod
+d %mod *d %mod *d %mod *(b-a+1) %mod *(b-a+1) %mod *(b-a) %mod *(b-a) %mod )%mod;
if(ACsum3!=4*s3 or ACsum2!=s2*6) cout<<"yuanxing\n";
else cout<<"damushen\n";
}
}
return 0;
}