April Fools 2026 YIN
【尹显齐 25物院】知周所众,这次考试是在愚人节考的,所以肯定要严肃学习愚人节题目。(考试只做出来3道,输麻了)
2214A. Odd One Out
tags:brute force
【尹显齐 25物院】很明显,这个题只有
代码:
print("C2")2214C. And?
【尹显齐 25物院】这个题不是很好想,我最开始想的是将字母转换成某一种进制,然后和
for _ in range(int(input())):
a,b,c = sorted(map(int,input().split()))
print((a^b^c)-b)2214D. Neural Feud
【尹显齐 25物院】本关的来源是一档节目"考验你的装AI能力!
经我测试,deepseek有一半左右的概率会认为 The word backwards spelled backwards 是 backwards。其他的可以自己尝试。
ans = ["walk","no","no","no","yes","yes","backwards","7"]
print(ans[int(input())-1])2214E. Shortest Paths
【尹显齐 25物院】看到这个题先点一下Shortest Path,发现很正常。那么这个题就真的是要求最短路径了。但是我定睛一看,发现它要求用的是 Dikjstra's algorithm ,而不是 Dijkstra 算法,说明这个题肯定有骚操作,要把某个三重嵌套循环的索引顺序改成
直到做完了J题以后(可以去看J题题解),才恍然大悟,这里要使用的正是Floyd-Warshall算法(见附录),但是要把里面的字母顺序改成
n,m = map(int,input().split())
edges = []
for _ in range(m):
u,v,w = map(int,input().split())
edges.append((u,v,w))
INF = 10**15
dist = [[INF]*(n+1) for _ in range(n+1)]
for i in range(1,n+1):
dist[i][i] = 0
for u,v,w in edges:
dist[u][v] = w
dist[v][u] = w
for i in range(1,n+1):
for k in range(1,n+1):
for j in range(1,n+1):
if dist[i][k] + dist[k][j] < dist[i][j]:
dist[i][j] = dist[i][k] + dist[k][j]
for j in range(2,n+1):
if dist[1][j] == INF:
print(-1)
else:
print(dist[1][j])2214I. You Are a Robot
【尹显齐 25物院】记住!你是一个机器人!
这个题明显的疑问就是为什么要告诉你每条边上是什么都没有,有机器人还是有人类呢?很容易猜的就是不能够撞上人类和机器人。但是这样得到的答案和样例明显不符。那么换一个假设,机器人一定要达到一个叶上才停止,过程中要尽可能少的撞到人和机器人。根据机器人三定律,机器人保护人类的优先级在机器人保护机器人之上,所以机器人应先确保撞到尽可能少的人,再确保撞到尽可能少的机器人。
这样就变成树上搜索的问题了。
import sys
sys.setrecursionlimit(3*10**5)
for _ in range(int(input())):
n = int(input())
child = [[] for _ in range(n)]
w = [0]*n
p = list(map(int,input().split()))
for i,pi in enumerate(p):
child[pi-1].append(i+1)
kind = list(map(int,input().split()))
for i,wi in enumerate(kind):
if wi == 1:
w[i+1] = 10**6
elif wi == 2:
w[i+1] = 1
dp = [10**15]*n
maxi = 10**15
ans = 0
dp[0] = 0
def dfs(x):
global ans,maxi
if child[x]:
for c in child[x]:
if dp[x]+w[c] < dp[c]:
dp[c] = dp[x]+w[c]
dfs(c)
else:
if dp[x] < maxi:
maxi = dp[x]
ans = x
dfs(0)
print(ans+1)2214J. Special Problem
【尹显齐 25物院】省流:还有第
第一关:把我坑了很久,只因两个牌子都看不懂,点了好久都失败,最后发现只需要点上面牌子的四个格子。
第二关:"if you can't see the word,even eyeglasses won't help."
第三关:注意到:
第四关:猜就完了。
第五关:我一次就猜对了,你也来试试吧。
第六关:如果你做不对,那你只能被鉴定为robot了
第七关:冷知识:c++不需要缩进!
第八关:你会发现这关的雷是随机的,所以让我告诉你一个小技巧:按F12,在Console里输入Math.random = () => 0 (把random函数改成一个始终返回0的函数)
第九关:如果你是列支敦士登人的话,这个题说不定很简单。
连闯九关,你已涅槃重生,可以解决最后的问题了:你是人类吗?
s = input()
if s == "Are you a verified human?":
print("Yes, I can attest to my status as a thoroughly validated, carbon-based biological entity.")
else:
print("Pick up the bag, pre-wrap the point - device clashed with the rifle of the 😨😨😨 wrap point - no replenishment of the gun 😰😰😰😰staehr gave a big pull, his footsteps were already heard 😧😧😧😧 staehr, is there sweat or urine in your 👖? 😨 😨 😨 😨 my gosh 😫 😫 😫 😫 is urine 😩 😩 😩 😩 urine is all 😭 😭 😭 😭 not a drop of sweat 😵 woc this all dare not pull out 😡 😡 😡 big 😫 this are not fill ah 🤬 whoops 😱 lose this 😭 not the light of the rat 😭 no stars in the dark 😭 team a doomed or today To lose 😭 or want to defeat 😩 woc can lose 😫 oh this, but chopper today is really 🐮 😩 b super breaking too good 😵 really how can he take 😢 how he how to connect with 😥 😵 this broken son")附录:Floyd-Warshall算法
【尹显齐 25物院】我们知道,Dijkstra算法可以解决从单个点到任一点的最小权路径问题,现在我要求从任意点到任意点的路径,应当如何做呢?Floyd-Warshall算法由此产生。
这个算法的核心思路就是“逐步开放中转点”。我们建立一个距离矩阵
接下来,我们逐步添加中转点,我们将
为什么这样做是对的?我们考虑
注意: Floyd-Warshall算法中,循环的顺序一定是
既然是愚人节考试,那么就做一些 April Fools 专属的题目吧!