Submission #11657581
Source Code Expand
package main import "fmt" func main() { var N, M int fmt.Scan(&N, &M) a, b := make([]int, N), make([]int, N) c, d := make([]int, M), make([]int, M) for i := 0; i < N; i++ { fmt.Scan(&a[i], &b[i]) } for i := 0; i < M; i++ { fmt.Scan(&c[i], &d[i]) } res := make([]int, N) for i := 0; i < N; i++ { minValue := 2147483647 minIndex := 0 for j := 0; j < M; j++ { v := abs(a[i]-c[j]) + abs(b[i]-d[j]) if minValue > v { minValue = v minIndex = j } } res[i] = minIndex + 1 } for i := 0; i < N; i++ { fmt.Println(res[i]) } } func abs(n int) int { if n < 0 { return -n } return n }
Submission Info
Submission Time | |
---|---|
Task | B - Checkpoints |
User | muragaruhae |
Language | Go (1.6) |
Score | 200 |
Code Size | 672 Byte |
Status | AC |
Exec Time | 3 ms |
Memory | 512 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 | 1 ms | 512 KB |
sample_02.txt | AC | 1 ms | 512 KB |
sample_03.txt | AC | 1 ms | 512 KB |
subtask_1_1.txt | AC | 2 ms | 512 KB |
subtask_1_2.txt | AC | 2 ms | 512 KB |
subtask_1_3.txt | AC | 2 ms | 512 KB |
subtask_1_4.txt | AC | 1 ms | 512 KB |
subtask_1_5.txt | AC | 2 ms | 512 KB |
subtask_1_6.txt | AC | 2 ms | 512 KB |
subtask_1_7.txt | AC | 3 ms | 512 KB |