답안 #725961

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
725961 2023-04-18T09:22:41 Z browntoad Exhibition (JOI19_ho_t2) Java 11
컴파일 오류
0 ms 0 KB
import java.util.*;
 
class FastIO extends PrintWriter {
	private InputStream stream;
	private byte[] buf = new byte[1 << 16];
	private int curChar;
	private int numChars;
 
	// standard input
	public FastIO() { this(System.in, System.out); }
 
	public FastIO(InputStream i, OutputStream o) {
		super(o);
		stream = i;
	}
 
	// file input
	public FastIO(String i, String o) throws IOException {
		super(new FileWriter(o));
		stream = new FileInputStream(i);
	}
 
	// throws InputMismatchException() if previously detected end of file
	private int nextByte() {
		if (numChars == -1) { throw new InputMismatchException(); }
		if (curChar >= numChars) {
			curChar = 0;
			try {
				numChars = stream.read(buf);
			} catch (IOException e) { throw new InputMismatchException(); }
			if (numChars == -1) {
				return -1;  // end of file
			}
		}
		return buf[curChar++];
	}
 
	// to read in entire lines, replace c <= ' '
	// with a function that checks whether c is a line break
	public String next() {
		int c;
		do { c = nextByte(); } while (c <= ' ');
 
		StringBuilder res = new StringBuilder();
		do {
			res.appendCodePoint(c);
			c = nextByte();
		} while (c > ' ');
		return res.toString();
	}
 
	public int nextInt() {  // nextLong() would be implemented similarly
		int c;
		do { c = nextByte(); } while (c <= ' ');
 
		int sgn = 1;
		if (c == '-') {
			sgn = -1;
			c = nextByte();
		}
 
		int res = 0;
		do {
			if (c < '0' || c > '9') { throw new InputMismatchException(); }
			res = 10 * res + c - '0';
			c = nextByte();
		} while (c > ' ');
		return res * sgn;
	}
 
	public double nextDouble() { return Double.parseDouble(next()); }
}
class Pair {
    int x;
    int y;
 
    // Constructor
    public Pair(int x, int y) {
        this.x = x;
        this.y = y;
    }
}
 
class ArrayOfPairsSorter {
 
    static void sort(Pair[] arr) {
        Comparator<Pair> comparator = new Comparator<>() {
            @Override
            public int compare(Pair p1, Pair p2) {
                if (p1.y == p2.y) return p1.x - p2.x; 
                return p1.y - p2.y;
            }
        };
        Arrays.sort(arr, comparator);
    }
}
 
 
class joi2019_ho_t2 {
    public static void main(String[] args){
        FastIO io = new FastIO();
        int N = io.nextInt();
        int M = io.nextInt();
 
        Pair[] pictures = new Pair[N];
        ArrayList<Integer> frame = new ArrayList<Integer>();
 
        for (int i=0; i<N; i++) {
            pictures[i] = new Pair(io.nextInt(), io.nextInt());
        }
 
        for (int i=0; i<M; i++) {
            frame.add(io.nextInt());
        }
 
        ArrayOfPairsSorter.sort(pictures);
 
        Collections.sort(frame);
int paintingCounter = N;
 
        int frameCounter = M-1;
        for (int i=N-1; i>=0; i--) {
            if (frameCounter >= 0) {
                if (pictures[i].x <= frame.get(frameCounter)) {
                    frameCounter -= 1;
                }
            }
        }
        System.out.println(M - 1 - frameCounter);
    }
}

Compilation message

joi2019_ho_t2.java:3: error: cannot find symbol
class FastIO extends PrintWriter {
                     ^
  symbol: class PrintWriter
joi2019_ho_t2.java:4: error: cannot find symbol
	private InputStream stream;
	        ^
  symbol:   class InputStream
  location: class FastIO
joi2019_ho_t2.java:12: error: cannot find symbol
	public FastIO(InputStream i, OutputStream o) {
	              ^
  symbol:   class InputStream
  location: class FastIO
joi2019_ho_t2.java:12: error: cannot find symbol
	public FastIO(InputStream i, OutputStream o) {
	                             ^
  symbol:   class OutputStream
  location: class FastIO
joi2019_ho_t2.java:18: error: cannot find symbol
	public FastIO(String i, String o) throws IOException {
	                                         ^
  symbol:   class IOException
  location: class FastIO
joi2019_ho_t2.java:19: error: cannot find symbol
		super(new FileWriter(o));
		          ^
  symbol:   class FileWriter
  location: class FastIO
joi2019_ho_t2.java:20: error: cannot find symbol
		stream = new FileInputStream(i);
		             ^
  symbol:   class FileInputStream
  location: class FastIO
joi2019_ho_t2.java:30: error: cannot find symbol
			} catch (IOException e) { throw new InputMismatchException(); }
			         ^
  symbol:   class IOException
  location: class FastIO
8 errors