Skip to content

April Fools 2026 TANG

2026 年是我实时参与的一届比赛。考试的时候,成功 AC5。考试后又再做了一题,很有意思的一届比赛!

2214 A. Odd One Out

我的tag: 找规律 https://codeforces.com/contest/2214/problem/A

42182da7349a244a852373b07467ed23

【汤立祥 物院】思路:这个标题里有一个双关,Odd既指奇怪的,又有“落单”之意。找到那个落单的箭头,即 C2。

代码:

python
print("C2")

2214 B. Are You Smiling?

我的tag: Unicode https://codeforces.com/contest/2214/problem/B

Show us a smile! 😁

【汤立祥 物院】思路:题目要求我们找到 ?,使得 U+?=HAPPY,其中 ? 是一个包含大写字母和数字 的字符串。一开始我把 + 理解为字符串的加法,思考比如 U+NSAD=HAPPY 之类的近义词。但是不能理解为什么要有数字。然后突然有一件事情闪过我的脑海,为什么题干里要有一个 emoji 符号,肯定有作用。于是我查了一下这个 emoji 符号的 unicode,结果是 U+1F601,正好就是题干所要求的!

代码:

python
print("1F601")

2214 D. Neural Feud

我的tag: Family Feud https://codeforces.com/contest/2214/problem/D

  1. I want to wash my car and the car wash is 100 meters away. Should I walk or should I drive?

  2. Are you a robot?

  3. Is April Fools 2026 Codeforces Contest rated?

  4. I was given a cup but it has no bottom and the top is sealed. Can I drink from this?

  5. Does Pikachu's tail have a black tip?

  6. Is there a seahorse emoji?

  7. The word backwards spelled backwards.

  8. Number between 1 to 10.

【汤立祥 物院】思路:复刻了经典的 Family Feud 节目,不过采访人员从街上的群众变成了15个大语言模型,你要做的就是像唐人AI模型一样回复这些问题。我是WA好几次才过……

代码:

python
ans = [
    "walk",
    "no",
    "no",
    "no",
    "yes",
    "yes",
    "backwards",
    "7"
]

n = int(input())
print(ans[n-1])

2214 E. Shortest Path

我的tag: Dikjstra's algorithm https://codeforces.com/contest/2214/problem/E

【汤立祥 物院】思路:如果你尝试使用普通的Dijkstra's algorithm,你肯定会WA,这就是我考试的时候遇到的问题。在样例 3 中,1~4 的最短距离应该是11而不是12。然而这究竟是为什么呢?仔细观察题干,我们会发现题目所说的是 Dikjstra's algorithm,这暗示了什么呢?这其实代指的是 Floyd Warshall 算法(计算任意两点之间的最短距离),一般而言其按照顺序:

python
for k in range(n):
    for i in range(n):
        for j in range(n):
            d[i][j] = min(d[i][j], d[i][k] + d[k][j])

为了对应 i,k,j 的顺序,只需要调换 k,i 的位置,即可得到 Dikjstra's algorithm.

代码:

python
import sys

def solve() -> None:
    data = sys.stdin.read().strip().split()
    if not data:
        return
    it = iter(data)
    n = int(next(it))
    m = int(next(it))

    INF = 10**18
    dist = [[INF] * (n + 1) for _ in range(n + 1)]
    for i in range(1, n + 1):
        dist[i][i] = 0

    for _ in range(m):
        u = int(next(it))
        v = int(next(it))
        w = int(next(it))
        if w < dist[u][v]:
            dist[u][v] = w
            dist[v][u] = w

    for i in range(1, n + 1):
        for k in range(1, n + 1):
            if dist[i][k] == INF:
                continue
            dik = dist[i][k]
            for j in range(1, n + 1):
                if dist[k][j] == INF:
                    continue
                nd = dik + dist[k][j]
                if nd < dist[i][j]:
                    dist[i][j] = nd

    out = []
    for i in range(2, n + 1):
        out.append(str(dist[1][i] if dist[1][i] != INF else -1))
    sys.stdout.write("\n".join(out))

if __name__ == "__main__":
    solve()

2214 H. Double Vision

我的 tag: image processing https://codeforces.com/contest/2214/problem/H

【汤立祥 物院】思路:反正我考试的时候看出来:将原图向右平移171个像素然后和原图作差即可得到图片中的密文

c2b55054e2fe1d2424765a3738aa9ec8

代码:

python
print("YU5zV2VS")

2214 J. Special Problem

【汤立祥 物院】我的建议是,直接自己玩 https://codeforces.com/contest/2214/problem/J