| 시간 제한 | 메모리 제한 | 제출 | 정답 | 맞힌 사람 | 정답 비율 |
|---|---|---|---|---|---|
| 3 초 | 1024 MB | 1 | 1 | 1 | 100.000% |
Nowadays, the 5G mobile communication standard is being introduced everywhere. But progress does not stand still, and the researchers of the Lucifer Laboratory are working hard to develop a new communication standard. The development turns out to be so innovative that it was decided to call the new standard not 6G, but immediately 666G. Researchers claim that this technology will make it possible to call Satan himself.
The new technology can be described as follows. The $k$ comminication towers, which can be considered points on the plane, are located at the vertices of a convex $k$-gon. Any five pairwise different towers are the tops of a five-pointed star and allow serving subscribers inside a pentagon, which is bounded by edges of the five-pointed star.
You task is to test the load on communication towers using a model example. Let there be $n$ subscribers who can be considered as points on the plane inside the convex $k$-gon formed by the $k$ communication towers. We will assume that subscribers do not change their location. For each subscriber it is known whether he is active or not.
Further, there are $q$ events of two types, ordered chronologically:
You need to simulate all events and respond to all requests of type 2ドル$.
The first line contains an integer $k$ --- the number of communication towers (5ドル \le k \le 30$).
The $i$-th of the following $k$ lines contains two integers $X_i$ and $Y_i$ --- coordinates of the $i$-th communication tower. It is guaranteed that the communication towers are at the vertices of a strictly convex $k$-gon, that is, no three towers are on the same straight line. The towers are listed in clockwise order of traversing this $k$ -gon.
Further on a separate line is an integer $n$ --- the number of subscribers (1ドル \le n \le 50,000円$).
The $i$-th of the following $n$ lines contains three integers $x_i,ドル $y_i$ and $z_i$ --- the coordinates of the $i$ -th subscriber and his activity. $z_i=1$ means that the $i$ -th subscriber is active, $z_i=0$ --- that he is not. It is guaranteed that all subscribers are strictly inside the convex $k$-gon formed by communication towers. No subscriber is on the segment that connects any two communication towers.
Further on a separate line is an integer $q$ --- the number of events (1ドル \le q \le 50,000円$).
The $i$-th of the following $q$ lines describes the $i$-th event. An event of type 1ドル$ is written as "1ドル$ $t$", where $t$ is the number of the subscriber for which the activity is changing (1ドル \le t \le n$). An event of type 2ドル$ is written as "2ドル$ $a_i$ $b_i$ $c_i$ $d_i$ $e_i$", where $a_i,ドル $b_i,ドル $c_i,ドル $d_i$ and $e_i$ --- tower indexes for which you need to determine the number of active served subscribers (1ドル \le a_i < b_i < c_i < d_i < e_i \le k$).
It is guaranteed that there is at least one request of the type 2ドル$.
The coordinates of all points are integers not exceeding 5ドル \times 10^5$ in absolute value. No two points in the input are equal.
Print $p$ lines, where $p$ is the number of events of type 2ドル$. In the $i$-th line, print one integer - the answer to the $i$-th query of the type 2ドル$.
6 0 2 1 7 7 7 8 3 7 1 4 0 6 1 4 1 3 3 1 4 3 0 4 2 1 5 4 1 6 3 1 8 2 1 2 3 4 5 2 1 2 3 4 6 1 3 2 1 2 3 4 6 2 1 2 3 5 6 2 1 2 4 5 6 2 1 3 4 5 6 2 2 3 4 5 6
2 2 3 3 1 0 1
The point configuration in the example is shown on picture above.