Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- int main() {
- int n, q;
- while (cin >> n >> q) {
- splay<int> t;
- for (int i = 0; i < n; i++) {
- int x; cin >> x;
- if (x) x = x > 0 ? 1 : -1;
- t.push_back(x);
- }
- while (q--) {
- char c; cin >> c;
- if (c == 'C') {
- int i, x; cin >> i >> x;
- if (x) x = x > 0 ? 1 : -1;
- t[i-1] = x;
- } else {
- int a, b; cin >> a >> b;
- int val = t.query(a-1, b-1);
- if (val > 0) cout << '+';
- else if (val < 0) cout << '-';
- else cout << 0;
- }
- }
- cout << endl;
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement