Submission #10123465
Source Code Expand
import java.util.*; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int n = sc.nextInt(); int m = sc.nextInt(); int[][] array = new int[n][2]; int[][] arrayC = new int[m][2]; for (int i=0; i<n; i++) { array[i][0] = sc.nextInt(); array[i][1] = sc.nextInt(); } for (int i=0; i<m; i++) { arrayC[i][0] = sc.nextInt(); arrayC[i][1] = sc.nextInt(); } for (int i=0; i<n; i++) { int x = array[i][0]; int y = array[i][1]; double min = Math.pow(10,8)*2; int minP = 0; for (int j=0; j<m; j++) { if (min > Math.abs(arrayC[j][0] - x) + Math.abs(arrayC[j][1]-y)) { min = Math.abs(arrayC[j][0] - x) + Math.abs(arrayC[j][1]-y); minP = j; } } System.out.println(minP +1); } } }
Submission Info
Submission Time | |
---|---|
Task | B - Checkpoints |
User | kento_okuno |
Language | Java8 (OpenJDK 1.8.0) |
Score | 200 |
Code Size | 1044 Byte |
Status | AC |
Exec Time | 116 ms |
Memory | 21716 KB |
Judge Result
Set Name | Sample | All | ||||
---|---|---|---|---|---|---|
Score / Max Score | 0 / 0 | 200 / 200 | ||||
Status |
|
|
Set Name | Test Cases |
---|---|
Sample | sample_01.txt, sample_02.txt, sample_03.txt |
All | sample_01.txt, sample_02.txt, sample_03.txt, subtask_1_1.txt, subtask_1_2.txt, subtask_1_3.txt, subtask_1_4.txt, subtask_1_5.txt, subtask_1_6.txt, subtask_1_7.txt |
Case Name | Status | Exec Time | Memory |
---|---|---|---|
sample_01.txt | AC | 95 ms | 19920 KB |
sample_02.txt | AC | 95 ms | 18900 KB |
sample_03.txt | AC | 96 ms | 21716 KB |
subtask_1_1.txt | AC | 102 ms | 21716 KB |
subtask_1_2.txt | AC | 116 ms | 21332 KB |
subtask_1_3.txt | AC | 100 ms | 20052 KB |
subtask_1_4.txt | AC | 99 ms | 21588 KB |
subtask_1_5.txt | AC | 103 ms | 21716 KB |
subtask_1_6.txt | AC | 110 ms | 19668 KB |
subtask_1_7.txt | AC | 110 ms | 19796 KB |