CF55E.Very simple problem

普及/提高-

通过率:0%

AC君温馨提醒

该题目为【codeforces】题库的题目,您提交的代码将被提交至codeforces进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。

题目描述

You are given a convex polygon. Count, please, the number of triangles that contain a given point in the plane and their vertices are the vertices of the polygon. It is guaranteed, that the point doesn't lie on the sides and the diagonals of the polygon.

输入格式

The first line contains integer nn — the number of vertices of the polygon ( 3<=n<=1000003<=n<=100000 ). The polygon description is following: nn lines containing coordinates of the vertices in clockwise order (integer xx and yy not greater than 10910^{9} by absolute value). It is guaranteed that the given polygon is nondegenerate and convex (no three points lie on the same line).

The next line contains integer tt ( 1<=t<=201<=t<=20 ) — the number of points which you should count the answer for. It is followed by tt lines with coordinates of the points (integer xx and yy not greater than 10910^{9} by absolute value).

输出格式

The output should contain tt integer numbers, each on a separate line, where ii -th number is the answer for the ii -th point.

Please, do not use %lld specificator to read or write 64-bit integers in C++. It is preffered to use cin (also you may use %I64d).

输入输出样例

  • 输入#1

    4
    5 0
    0 0
    0 5
    5 5
    1
    1 3
    

    输出#1

    2
    
  • 输入#2

    3
    0 0
    0 5
    5 0
    2
    1 1
    10 10
    

    输出#2

    1
    0
    
  • 输入#3

    5
    7 6
    6 3
    4 1
    1 2
    2 4
    4
    3 3
    2 3
    5 5
    4 2
    

    输出#3

    5
    3
    3
    4
    
首页