牛客2018多校训练-----Touring cities(黑白棋盘规律题)

这道题目来源于牛客网,要求在一个n*m的网格中,从(1,1)出发并返回,通过铁路和航空线路遍历所有城市至少一次,寻找最小旅行时间。每行每列构成一个棋盘格,存在K条直飞航线。解决方案涉及对棋盘格奇偶性的分析,以找到最短路径。" 128353143,919409,使用ONNX推理实现MDIPIPE姿态估计,"['计算机视觉', '深度学习', '模型部署', '移动开发', 'Python']
摘要由CSDN通过智能技术生成

链接:https://www.nowcoder.com/acm/contest/146/E
来源:牛客网
 

时间限制:C/C++ 2秒,其他语言4秒
空间限制:C/C++ 262144K,其他语言524288K
64bit IO Format: %lld

题目描述

Niuniu wants to tour the cities in Moe country. Moe country has a total of n*m cities. The positions of the cities form a grid with n rows and m columns. We represent the city in row x and column y as (x,y). (1 ≤ x ≤ n,1 ≤ y ≤ m) There are bidirectional railways between adjacent cities. (x1,y1) and (x2,y2) are called adjacent if and only if |x1-x2|+|y1-y2|=1. There are also K bidirectional air lines between K pairs of cities. It takes Niuniu exactly one day to travel by a single line of railway or airplane. Niuniu starts and ends his tour in (1,1). What is the minimal time Niuniu has to travel between cities so that he can visit every city at least once

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值