#include #include #include #include typedef long long data_t; //typedef int data_t; // for a wrong solution const data_t NEG_INF = std::numeric_limits::min(); template bool check(Iterator from, Iterator until) { data_t prev_minimum = NEG_INF; data_t prev_value = *from++; bool can_be_local_min = true; while (from != until) { data_t curr_value = *from++; if (curr_value == prev_value) { continue; } if (prev_value < curr_value) { if (can_be_local_min) { if (prev_minimum >= prev_value) { return false; } prev_minimum = prev_value; } can_be_local_min = false; } else { can_be_local_min = true; } prev_value = curr_value; } return !can_be_local_min || prev_minimum < prev_value; } template void update(Iterator from, Iterator until, int delta) { while (from != until) { *from += delta; ++from; } } int main() { // read the initial array unsigned n; std::cin >> n; std::vector data(n); for (unsigned i = 0; i < n; ++i) { std::cin >> data[i]; } // read the commands unsigned m; std::string cmd; std::cin >> m; for (unsigned i = 0; i < m; ++i) { unsigned left, right; std::cin >> cmd >> left >> right; if (cmd[0] == 'c') { bool result = check(data.begin() + left - 1, data.begin() + right); std::cout << (result ? "YES\n" : "NO\n"); } else { int delta; std::cin >> delta; update(data.begin() + left - 1, data.begin() + right, delta); } } return 0; }