Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import static java.lang.Math.max;
- import static java.lang.Math.min;
- import java.io.*;
- import java.math.*;
- import java.util.*;
- import java.awt.geom.*;
- class Task implements Runnable{
- final String fname="";
- BufferedReader in;
- PrintWriter out;
- StringTokenizer st;
- private String next() throws Exception {
- if (st == null || !st.hasMoreTokens()) {
- String line=in.readLine().trim();
- while(line.length() == 0)
- line=in.readLine().trim();
- st = new StringTokenizer(line);
- }
- return st.nextToken();
- }
- private int nextInt() throws Exception {
- return Integer.parseInt(next());
- }
- private long nextLong() throws Exception {
- return Long.parseLong(next());
- }
- private double nextDouble() throws Exception {
- return Double.parseDouble(next());
- }
- public static void main(String[] args) {
- new Thread(null, new Task(), "", (1<<25)).start();
- }
- public void run() {
- try {
- in = new BufferedReader(new FileReader("input.txt"));
- out = new PrintWriter(new FileWriter("output.txt"));
- //in = new BufferedReader(new InputStreamReader(System.in));
- //out = new PrintWriter(System.out);
- solve();
- } catch (Exception e) {
- throw new RuntimeException(e);
- } finally {
- out.close();
- }
- }
- double py[],px[];
- double dy[],dx[];
- public void solve() throws Exception {
- int n=nextInt(); int m=nextInt();
- py=new double [n];
- px=new double [n];
- dy=new double [n];
- dx=new double [n];
- for (int i=0;i<n;i++) {
- px[i]=nextDouble();
- py[i]=nextDouble();
- }
- for (int i=0;i<n;i++) {
- dx[i]=nextDouble();
- dy[i]=nextDouble();
- }
- GeneralPath path = new GeneralPath();
- for (int i=0;i<n;i++) {
- path.append(new QuadCurve2D.Double(px[i], py[i], dx[i], dy[i], px[(i+1)%n], py[(i+1)%n]), true);
- }
- Area global = new Area(path);
- int ret=0;
- for (int i=0;i<m;i++) {
- if (global.contains(nextDouble(),nextDouble())) ret++;
- }
- out.println(ret);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement