Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <cstdio>
- #include <iostream>
- #define N int(5e4 + 5)
- using namespace std;
- int z[N], n, m;
- int main()
- {
- freopen("rect2.in", "r", stdin);
- freopen("rect2.out", "w", stdout);
- scanf("%d ", &n);
- for (int i = 1; i <= n; i++)
- scanf("%d ", z + i);
- scanf("%d ", &m);
- for (int i = 0; i < m; i++)
- {
- char query;
- scanf("%c ", &query);
- if (query == 'Q')
- {
- int res = 0;
- int x1, x2, y1, y2;
- scanf("%d %d %d %d ", &x1, &y1, &x2, &y2);
- for (int i = x1; i <= x2; i++)
- {
- int val1 = min(y2, z[i]) - y1;
- int val2 = y2 - y1 - val1;
- if (val1 > val2)
- res++;
- if (val2 > val1)
- res--;
- }
- if (res > 0) cout << "2\n";
- if (res < 0) cout << "1\n";
- if (!res) cout << "0\n";
- }
- else
- {
- int x, dz;
- scanf("%d %d %d %d ", &x, &dz);
- z[x] = dz;
- }
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement