Message
Message
h"
using namespace std;
#define ep emplace_back
#define pb push_back
#define pf push_front
bool START;
int n, q, x,a[N];
ll p[N];
struct node {
ll min, sum;
node(ll min_ = oo, ll sum_ = 0) : min(min_), sum(sum_) {}
node operator+(const node &other) const {
node res;
if (min < other.min) {
res.min = min;
} else {
res.min = other.min;
}
res.sum = sum + other.sum;
return res;
}
};
struct ST {
node st[N << 2];
int l, r; ll x;
if (t == '?') {
cin >> l >> r >> x;
int len = r - l + 1;
if (len == 1) {
cout << ((x == p[a[l]]) ? "YES" : "NO") << endl;
continue;
}
if (len == 2) {
cout << ((x == p[a[r]] - p[a[l]]) ? "YES" : "NO") << endl;
continue;
}
ll need = x - p[a[r]] + p[a[r - 1]];
auto[Min, sum] = st.get(1, 1, n, l, r - 2);
ll gw = p[Min];
if (need % gw != 0) {
cout << "NO" << endl;
} else {
ll sum_ = sum / gw;
ll need_ = need / gw;
cout << ((abs(need_) > sum_ || ((sum_ - need_) & 1)) ? "NO"
: "YES") << endl;
}
}
}
}
int main() {
if(fopen(task ".inp", "r")) {
freopen(task ".inp", "r", stdin);
freopen(task ".out", "w", stdout);
}
ios_base::sync_with_stdio(false);
cin.tie(nullptr); cout.tie(nullptr);
input();
cerr << "Time elapsed: " << 1.0 * clock() / CLOCKS_PER_SEC << 's' << endl;
cerr << "Memory: " << fabs ((&END - &START)) / 1048576.0 << "MB\n";
return 0;
}