답안 #726066

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
726066 2023-04-18T12:16:32 Z vjudge1 Exhibition (JOI19_ho_t2) Java 11
50 / 100
1000 ms 27440 KB
import java.util.ArrayList;
import java.util.Collections;
import java.util.Scanner;
import java.util.Arrays;
import java.util.Comparator;


// User defined Pair class

class Pair {
    int x;
    int y;

    // Constructor
    public Pair(int x, int y) {
        this.x = x;
        this.y = y;
    }
}
// class to define user defined comparator
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 == 0) {
                    return p1.x - p2.x;
                } else {
                    return p1.y - p2.y;
                }
            }
        };
        Arrays.sort(arr, comparator);
    }
}


class joi2019_ho_t2 {
    public static void main(String[] args){
        Scanner scanner = new Scanner(System.in);
        int N = scanner.nextInt();
        int M = scanner.nextInt();

        Pair[] pictures = new Pair[N];
        ArrayList<Integer> frame = new ArrayList<Integer>();

        for (int i=0; i<N; i++) {
            pictures[i] = new Pair(scanner.nextInt(), scanner.nextInt());
        }

        for (int i=0; i<M; i++) {
            frame.add(scanner.nextInt());
        }

        ArrayOfPairsSorter.sort(pictures);

        Collections.sort(frame);


        int frameCounter = M;
        for (int i=N; i>0; i--) {
            if (frameCounter > 0) {
                if (pictures[i-1].x <= frame.get(frameCounter-1)) {
                    frameCounter -= 1;
                }
            }
        }
        System.out.println(M - frameCounter);
    }
}
# 결과 실행 시간 메모리 Grader output
1 Correct 120 ms 10504 KB Output is correct
2 Correct 118 ms 10416 KB Output is correct
3 Correct 150 ms 10088 KB Output is correct
4 Correct 153 ms 10092 KB Output is correct
5 Correct 115 ms 10352 KB Output is correct
6 Correct 103 ms 10220 KB Output is correct
7 Correct 101 ms 10132 KB Output is correct
8 Correct 116 ms 10276 KB Output is correct
9 Correct 109 ms 10160 KB Output is correct
10 Correct 105 ms 10228 KB Output is correct
11 Correct 107 ms 10164 KB Output is correct
12 Correct 119 ms 10456 KB Output is correct
13 Correct 104 ms 10148 KB Output is correct
14 Correct 100 ms 10352 KB Output is correct
15 Correct 102 ms 10220 KB Output is correct
16 Correct 102 ms 10120 KB Output is correct
17 Correct 111 ms 10160 KB Output is correct
18 Correct 102 ms 10204 KB Output is correct
19 Correct 100 ms 10080 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 120 ms 10504 KB Output is correct
2 Correct 118 ms 10416 KB Output is correct
3 Correct 150 ms 10088 KB Output is correct
4 Correct 153 ms 10092 KB Output is correct
5 Correct 115 ms 10352 KB Output is correct
6 Correct 103 ms 10220 KB Output is correct
7 Correct 101 ms 10132 KB Output is correct
8 Correct 116 ms 10276 KB Output is correct
9 Correct 109 ms 10160 KB Output is correct
10 Correct 105 ms 10228 KB Output is correct
11 Correct 107 ms 10164 KB Output is correct
12 Correct 119 ms 10456 KB Output is correct
13 Correct 104 ms 10148 KB Output is correct
14 Correct 100 ms 10352 KB Output is correct
15 Correct 102 ms 10220 KB Output is correct
16 Correct 102 ms 10120 KB Output is correct
17 Correct 111 ms 10160 KB Output is correct
18 Correct 102 ms 10204 KB Output is correct
19 Correct 100 ms 10080 KB Output is correct
20 Correct 291 ms 15088 KB Output is correct
21 Correct 335 ms 15108 KB Output is correct
22 Correct 297 ms 14964 KB Output is correct
23 Correct 341 ms 15024 KB Output is correct
24 Correct 316 ms 15160 KB Output is correct
25 Correct 348 ms 14916 KB Output is correct
26 Correct 305 ms 15004 KB Output is correct
27 Correct 334 ms 14992 KB Output is correct
28 Correct 309 ms 14792 KB Output is correct
29 Correct 304 ms 14996 KB Output is correct
30 Correct 331 ms 15004 KB Output is correct
31 Correct 333 ms 15036 KB Output is correct
32 Correct 277 ms 15144 KB Output is correct
33 Correct 219 ms 12404 KB Output is correct
34 Correct 302 ms 14964 KB Output is correct
35 Correct 255 ms 13980 KB Output is correct
36 Correct 331 ms 14840 KB Output is correct
37 Correct 312 ms 14836 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 120 ms 10504 KB Output is correct
2 Correct 118 ms 10416 KB Output is correct
3 Correct 150 ms 10088 KB Output is correct
4 Correct 153 ms 10092 KB Output is correct
5 Correct 115 ms 10352 KB Output is correct
6 Correct 103 ms 10220 KB Output is correct
7 Correct 101 ms 10132 KB Output is correct
8 Correct 116 ms 10276 KB Output is correct
9 Correct 109 ms 10160 KB Output is correct
10 Correct 105 ms 10228 KB Output is correct
11 Correct 107 ms 10164 KB Output is correct
12 Correct 119 ms 10456 KB Output is correct
13 Correct 104 ms 10148 KB Output is correct
14 Correct 100 ms 10352 KB Output is correct
15 Correct 102 ms 10220 KB Output is correct
16 Correct 102 ms 10120 KB Output is correct
17 Correct 111 ms 10160 KB Output is correct
18 Correct 102 ms 10204 KB Output is correct
19 Correct 100 ms 10080 KB Output is correct
20 Correct 291 ms 15088 KB Output is correct
21 Correct 335 ms 15108 KB Output is correct
22 Correct 297 ms 14964 KB Output is correct
23 Correct 341 ms 15024 KB Output is correct
24 Correct 316 ms 15160 KB Output is correct
25 Correct 348 ms 14916 KB Output is correct
26 Correct 305 ms 15004 KB Output is correct
27 Correct 334 ms 14992 KB Output is correct
28 Correct 309 ms 14792 KB Output is correct
29 Correct 304 ms 14996 KB Output is correct
30 Correct 331 ms 15004 KB Output is correct
31 Correct 333 ms 15036 KB Output is correct
32 Correct 277 ms 15144 KB Output is correct
33 Correct 219 ms 12404 KB Output is correct
34 Correct 302 ms 14964 KB Output is correct
35 Correct 255 ms 13980 KB Output is correct
36 Correct 331 ms 14840 KB Output is correct
37 Correct 312 ms 14836 KB Output is correct
38 Execution timed out 1071 ms 27440 KB Time limit exceeded
39 Halted 0 ms 0 KB -