import java.util.Arrays;
class Solution {
public int[] solution(int[][] score) {
int len = score.length;
int[] avg = new int[len];
for(int i = 0; i<len; i++) {
avg[i] = (score[i][0] + score[i][1]) / 2;
}
int[] answer = Arrays.copyOf(avg, len);
Arrays.sort(avg);
for(int i = 0; i<len; i++) {
answer[i] = len-Arrays.binarySearch(avg, answer[i]);
}
return answer;
}
}
import java.util.Arrays;
class Solution {
public int[] solution(int[][] score) {
int len = score.length;
double[] avg = new double[len];
for(int i = 0; i<len; i++) {
avg[i] = (score[i][0] + score[i][1]) / 2;
}
double[] avg_copy = Arrays.copyOf(avg, len);
Arrays.sort(avg_copy);
int[] answer = new int[len];
for(int i = 0; i<len; i++) {
answer[i] = len-Arrays.binarySearch(avg_copy, avg[i]);
System.out.print(len-Arrays.binarySearch(avg_copy, avg[i]));
}
return answer;
}
}