# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
725356 |
2023-04-17T10:39:45 Z |
vjudge1 |
Exhibition (JOI19_ho_t2) |
Java 11 |
|
116 ms |
10540 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) {
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>(M);
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-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);
}
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
111 ms |
10540 KB |
Output is correct |
2 |
Correct |
116 ms |
10080 KB |
Output is correct |
3 |
Incorrect |
112 ms |
10144 KB |
Output isn't correct |
4 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
111 ms |
10540 KB |
Output is correct |
2 |
Correct |
116 ms |
10080 KB |
Output is correct |
3 |
Incorrect |
112 ms |
10144 KB |
Output isn't correct |
4 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
111 ms |
10540 KB |
Output is correct |
2 |
Correct |
116 ms |
10080 KB |
Output is correct |
3 |
Incorrect |
112 ms |
10144 KB |
Output isn't correct |
4 |
Halted |
0 ms |
0 KB |
- |