3292. 称检测点查询

摘要
Title: 3292. 称检测点查询
Tag: 模拟
Memory Limit: 64 MB
Time Limit: 1000 ms

Powered by:NEFU AB-IN

Link

3292. 称检测点查询

  • 题意

    见原题

  • 思路

    排序+模拟

  • 代码

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    '''
    Author: NEFU AB-IN
    Date: 2022-03-17 21:14:51
    FilePath: \ACM\Acwing\3292.py
    LastEditTime: 2022-03-17 21:14:52
    '''
    n, X, Y = map(int, input().split())

    nums = []
    for i in range(n):
    x, y = map(int, input().split())
    nums.append([x, y, i])

    nums.sort(key=lambda x: (x[0] - X)**2 + (x[1] - Y)**2)

    for i in range(3):
    print(nums[i][2] + 1)
使用搜索:谷歌必应百度