Darts

시간 제한1초메모리 제한2048 MB

요약
평면 위 타원 모양 과녁과 여러 시작점에서 나아가는 직선이 주어질 때, 과녁에 맞는 다트의 개수를 센다.
난이도

보통10점 중 6점

유형
기하, 수학, 구현, 완전 탐색
정답자
아직 제출이 없습니다

문제

You have joined a project called 'Flying Projectile Coding', which attempts to create a smart machine learning AI that will throw darts at a slightly modified dart board. Before the live testing of this AI, you have decided to train it in a simulation, because that is way faster and cheaper.

In this project, you are tasked with assessing the AI's performance. Since it is still in the early stages of its development, you are only interested in whether it hit the board or not. Also, for now, you just assume that gravity is negligible, so darts fly in straight lines.

The board

입력

  • One line with an integer: 1≤n≤1051 \leq n \leq 10^5: the number of darts that have been thrown.
  • Two lines with three floating-point numbers each: −10≤h_1,h_2,h_3≤10-10 \leq h\_1, h\_2, h\_3 \leq 10 and −10≤v_1,v_2,v_3≤10-10 \leq v\_1, v\_2, v\_3 \leq 10. The dart board is mounted at (0,0,0)(0, 0, 0) and is shaped like an ellipse with perpendicular axes (h_1,h_2,h_3)(h\_1, h\_2, h\_3) and (v_1,v_2,v_3)(v\_1, v\_2, v\_3).
  • nn lines with six floating-point numbers each: −100≤p_1,p_2,p_3≤100-100 \leq p\_1, p\_2, p\_3 \leq 100 and −10≤d_1,d_2,d_3≤10-10 \leq d\_1, d\_2, d\_3 \leq 10. This line indicates that a dart is thrown from position (p_1,p_2,p_3)(p\_1, p\_2, p\_3) in direction (d_1,d_2,d_3)(d\_1, d\_2, d\_3).

출력

The number of darts that hit the board.

예제2

  1. 예제 1

    입력
    3
    2.0 0.0 0.0
    0.0 1.0 0.0
    0.0 0.0 2.0 2.0 1.0 4.0
    0.0 0.0 -2.0 2.0 1.0 4.0
    0.0 0.0 2.0 2.0 0.0 0.0
    
    예상 출력
    1
    
  2. 예제 2

    입력
    6
    1.0 1.0 0.0
    1.0 -1.0 1.0
    0.0 0.0 1.0 0.0 0.0 -1.0
    0.0 0.0 1.0 1.0 1.0 0.0
    0.0 0.0 1.0 1.0 -1.0 1.0
    1.0 -1.0 -1.0 -1.0 1.0 8.0
    1.0 -1.0 -1.0 1.0 -1.0 8.0
    -1.0 1.0 1.0 1.0 -1.0 -8.0
    
    예상 출력
    3