- Deadly Decadence
hack,测试集要增强一下
- 2025-4-6 23:05:26 @
def solve(n, m, x, portals):
T = n * n
portal_map = {st: ed for st, ed in portals}
visited = set()
pos = 1
while True:
if pos == T:
return "yes"
if pos in visited:
return "no"
visited.add(pos)
if pos + x <= T:
next_pos = pos + x
else:
return "yes" if (T - pos) % x == 0 else "no"
while next_pos in portal_map:
next_pos = portal_map[next_pos]
pos = next_pos
n,m,x=map(int,input().split())
portals = []
for _ in range(m):
st,ed =map(int,input().split())
portals.append((st,ed))
print(solve(n, m, x, portals))
第一次超过T(理论上要折返继续操作)但直接输出no就可过
0 条评论
目前还没有评论...
信息
- ID
- 348
- 时间
- 1000ms
- 内存
- 256MiB
- 难度
- 9
- 标签
- (无)
- 递交数
- 27
- 已通过
- 4
- 上传者