Untitled
plain_text
25 days ago
2.5 kB
1
Indexable
Never
import java.io.File; import java.io.FileNotFoundException; import java.util.ArrayList; import java.util.Arrays; import java.util.Collections; import java.util.Comparator; import java.util.Scanner; public class universityzoning2 { public static void main(String[] args) throws FileNotFoundException { Scanner scanner = new Scanner(new File("input.txt")); // public static void main(String[] args) { // Scanner scanner = new Scanner(System.in); /* * 1. I need to know how many students are in the right faculty * 2. Compare with G (if it says it needs 2 faculty to meet the threshold, then * it should meet that) * 3. If lacking students, find the faculty that is lacking and then find the * nearest * student possible that is not inside the zone * 3.1 If there are other faculty that can also meet the requirement, you need * to compare which one is nearer and which one would accomplish it faster * ---> example if A needs 1 students and only 10 walks, but B needs 2 students * and each only needs 2 walks, means it would be fater with B */ // G = faculties with their compliance target met // --> met when there's at least T students in their assigned cells int row = scanner.nextInt(), col = scanner.nextInt(), numOfFac = scanner.nextInt(), numOfStudents = scanner.nextInt(), G = scanner.nextInt(); int[][][] zoneLocations = new int[numOfFac][][]; for (int i = 0; i < numOfFac; i++) { int facultyNumCells = scanner.nextInt(); zoneLocations[i] = new int[facultyNumCells][2]; // (x, y) coords for (int j = 0; j < facultyNumCells; j++) { int currRow = scanner.nextInt() - 1, currCol = scanner.nextInt() - 1; // location of the faculty zone zoneLocations[i][j][0] = currCol; // x coord zoneLocations[i][j][1] = currRow; // y coord } } for (int i = 0; i < zoneLocations.length; i++) { for (int j = 0; j < zoneLocations.length; j++) { System.out.println(String.join("", Integer.toString(zoneLocations[i][j][0]))); } } for (int i = 0; i < numOfStudents; i++) { // -1 because there's no 0,0 coord but instead it starts at 1,1 int currStudRow = scanner.nextInt() - 1, currStudCol = scanner.nextInt() - 1, // location of the students studId = scanner.nextInt(), studFaculty = scanner.nextInt(); } for (int i = 0; i < numOfFac; i++) { } } }