AtCoder Beginner Contest 057

Submission #10124329

Source codeソースコード

N, M = map(int, input().split())
people = [list(map(int, input().split())) for i in range(N)]
point = [list(map(int, input().split())) for i in range(M)]
ans = [-1] * N
def calc_dist(a, b):
    return abs(a[0] - b[0]) + abs(a[1] - b[1])


for i in range(len(people)):
    tmp = 1000000000
    for j in range(len(point)):
        dist = calc_dist(people[i], point[j])
        if dist < tmp:
            ans[i] = j
            tmp = dist

for i in ans:
    print(i+1)

Submission

Task問題 B - Checkpoints
User nameユーザ名 kagami
Created time投稿日時
Language言語 PyPy3 (2.4.0)
Status状態 AC
Score得点 200
Source lengthソースコード長 482 Byte
File nameファイル名
Exec time実行時間 195 ms
Memory usageメモリ使用量 39664 KB

Test case

Set

Set name Score得点 / Max score Cases
Sample - sample_01.txt,sample_02.txt,sample_03.txt
All 200 / 200 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

Test case

Case name Status状態 Exec time実行時間 Memory usageメモリ使用量
sample_01.txt AC 180 ms 38256 KB
sample_02.txt AC 186 ms 38384 KB
sample_03.txt AC 183 ms 38256 KB
subtask_1_1.txt AC 188 ms 38256 KB
subtask_1_2.txt AC 186 ms 38768 KB
subtask_1_3.txt AC 180 ms 38256 KB
subtask_1_4.txt AC 185 ms 38256 KB
subtask_1_5.txt AC 179 ms 38256 KB
subtask_1_6.txt AC 180 ms 38256 KB
subtask_1_7.txt AC 195 ms 39664 KB