Cod sursa(job #1486898)

Utilizator andreiiiiPopa Andrei andreiiii Data 15 septembrie 2015 18:07:16
Problema Robot Scor 0
Compilator java Status done
Runda Arhiva de probleme Marime 3.97 kb
import java.io.OutputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.FileInputStream;
import java.io.InputStream;
import java.io.PrintWriter;
import java.io.IOException;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream;
        try {
            inputStream = new FileInputStream("robot.in");
        } catch (IOException e) {
            throw new RuntimeException(e);
        }
        OutputStream outputStream;
        try {
            outputStream = new FileOutputStream("robot.out");
        } catch (IOException e) {
            throw new RuntimeException(e);
        }
        InputReader in = new InputReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        Robot solver = new Robot();
        solver.solve(1, in, out);
        out.close();
    }

    static class Robot {
        public void solve(int testNumber, InputReader in, PrintWriter out) {
            int N = in.nextInt();
            out.println(-1);
            return;
        /*Point[] robot = new Point[N];
        for (int i = 0; i < N; ++i) {
            robot[i] = new Point(in.nextDouble(), in.nextDouble());
        }

        int M = in.nextInt();
        Point[][] obstacles = new Point[M][];
        for (int i = 0; i < M; ++i) {
            int K = in.nextInt();
            obstacles[i] = new Point[K];
            for (int j = 0; j < K; ++j)
                obstacles[i][j] = new Point(in.nextDouble(), in.nextDouble());
        }

        for (int i = 0; i < M; ++i)
            obstacles[i] = expand(obstacles[i], robot);

        double minx = robot[0].x, miny = robot[0].y;
        for (int i = 1; i < N; ++i) {
            minx = Math.min(minx, robot[i].x);
            miny = Math.min(miny, robot[i].y);
        }

        //System.err.println(Arrays.toString(obstacles[0]));

        Point start = new Point(minx, miny), end = new Point(in.nextDouble(), in.nextDouble());
        if (!checkPoint(end, obstacles)) {
            out.println(-1);
            return;
        }

        int countPoints = 2;
        for (int i = 0; i < M; ++i)
            countPoints += obstacles[i].length;

        Point[] allPoints = new Point[countPoints];
        allPoints[0] = start;
        countPoints = 1;
        for (Point[] obstacle: obstacles)
            for (Point p: obstacle)
                allPoints[countPoints++] = p;

        allPoints[countPoints++] = end;

        //System.err.flush();

        double ans = shortestPath(allPoints, obstacles, 0, countPoints - 1);
        out.println(String.format("%.2f", ans));*/
        }

    }

    static class InputReader {
        private InputStream stream;
        private byte[] buf = new byte[1024];
        private int curChar;
        private int numChars;

        public InputReader(InputStream stream) {
            this.stream = stream;
        }

        public int read() {
            if (numChars == -1)
                throw new UnknownError();
            if (curChar >= numChars) {
                curChar = 0;
                try {
                    numChars = stream.read(buf);
                } catch (IOException e) {
                    throw new UnknownError();
                }
                if (numChars <= 0)
                    return -1;
            }
            return buf[curChar++];
        }

        public int nextInt() {
            return Integer.parseInt(next());
        }

        public String next() {
            int c = read();
            while (isSpaceChar(c))
                c = read();
            StringBuffer res = new StringBuffer();
            do {
                res.appendCodePoint(c);
                c = read();
            } while (!isSpaceChar(c));

            return res.toString();
        }

        private boolean isSpaceChar(int c) {
            return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
        }

    }
}