Logo
(追記) (追記ここまで)

31102번 - Five-pointed Queries 다국어

시간 제한메모리 제한제출정답맞힌 사람정답 비율
3 초 1024 MB111100.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:

  1. Subscriber numbered $t$ changes its activity. That is, if the subscriber was active, then he becomes inactive and vice versa.
  2. For some five pairwise different communication towers, it is necessary to determine the number of active subscribers who are served by these five towers.

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ドル$.

제한

예제 입력 1

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

예제 출력 1

2
2
3
3
1
0
1

노트

The point configuration in the example is shown on picture above.

출처

Contest > Open Cup > 2020/2021 Season > Stage 16: Grand Prix of Urals F번

(追記) (追記ここまで)

출처

대학교 대회

  • 사업자 등록 번호: 541-88-00682
  • 대표자명: 최백준
  • 주소: 서울시 서초구 서초대로74길 29 서초파라곤 412호
  • 전화번호: 02-521-0487 (이메일로 연락 주세요)
  • 이메일: contacts@startlink.io
  • 통신판매신고번호: 제 2017-서울서초-2193 호

AltStyle によって変換されたページ (->オリジナル) /