• [A] Anger Begins

  • 时间限制: 1000 ms 内存限制: 65535 K
  • 问题描述
  • かとん--Katon
    Long long ago, when Wodex was a child, he lived happily. Unfortunately, one day, The nightmare begins...

    Some ninjas attacked his village and the village fell into a big fire.Most of villagers were died. Witnessed it, Wodex was very afraid but angry. So, Wodex wanted to revenge.To be stronger, he needed to flee out of the village first. But owing to the fire, some roads were blocked.
    Now, there will be some roads which can be walked. Each road was straight, and the endpoint is P1 (x1, y1), P2 (x2, y2).
    x and y is the coordinate.

    Now he was on the road A, can he ran to road B? He can ran one road to another road if these two roads are connected. The number of road is from 1 to N.
    It is very urgent, help him!

  • 输入
  • Input until EOF.
    First line is an integer N (2 <= N <= 100) means the number of roads.
    Then N lines follow. Each line contains 4 double numbers x1, y1, x2 and y2, each number is between -1000.00 and 1000.00.
    Next line is a integer M (1 <= M <= 200) means the number of questions.
    Then M lines follow. Each line contains 2 integers A and B means the road A and road B.
  • 输出
  • For each question, if she can run from road A to road B, print 'YES', otherwise print 'NO'.
  • 样例输入
  • 4
    0 0 10 10
    0 10 10 0
    -1 -1 1 -1
    -2 -2 2 -2
    2
    1 2
    3 4
  • 样例输出
  • YES
    NO
  • 提示
  • 来源
  • Hungar
  • 操作

显示春菜