April Fools Day Contest 2026 题解

A Odd One Out

答案是C2 只有它出现恰好一次

B Are You Smiling?

U+?=HAPPY

想到emoji,答案是

cpp 复制代码
print("1F601")

D Neural Feud

Questions:

  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.

唯一难点是7,不过可以问一下deepseek

cpp 复制代码
#include<bits/stdc++.h> 

using namespace std;
#define For(i,n) for(int i=1;i<=n;i++)
#define Fork(i,k,n) for(int i=k;i<=n;i++)
#define ForkD(i,k,n) for(int i=n;i>=k;i--)
#define Rep(i,n) for(int i=0;i<n;i++)
#define ForD(i,n) for(int i=n;i;i--)
#define RepD(i,n) for(int i=n;i>=0;i--)
#define Forp(x) for(int p=pre[x];p;p=next[p])
#define Forpiter(x) for(int &p=iter[x];p;p=next[p])  
#define Lson (o<<1)
#define Rson ((o<<1)+1)
#define MEM(a) memset(a,0,sizeof(a));
#define MEMI(a) memset(a,0x3f,sizeof(a));
#define MEMi(a) memset(a,128,sizeof(a));
#define MEMx(a,b) memset(a,b,sizeof(a));
#define INF (0x3f3f3f3f)
#define F (1000000007)
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define vi vector<int> 
#define pi pair<int,int>
#define SI(a) ((a).size())
#define Pr(kcase,ans) printf("Case #%d: %lld\n",kcase,ans);
#define PRi(a,n) For(i,n-1) cout<<a[i]<<' '; cout<<a[n]<<endl;
#define PRi2D(a,n,m) For(i,n) { \
						For(j,m-1) cout<<a[i][j]<<' ';\
						cout<<a[i][m]<<endl; \
						} 
#pragma comment(linker, "/STACK:102400000,102400000")
#define ALL(x) (x).begin(),(x).end()
#define gmax(a,b) a=max(a,b);
#define gmin(a,b) a=min(a,b);
#ifdef DEBUG
#define _GLIBCXX_DEBUG
#endif

#define DEBUG
int recur_depth = 0;
#ifdef DEBUG
#define dbg(x) {++recur_depth; auto x_=x; --recur_depth; cerr<<string(recur_depth, '\t')<<"\e[91m"<<__func__<<":"<<__LINE__<<"\t"<<#x<<" = "<<x_<<"\e[39m"<<endl;}
#else
#define dbg(x)
#endif
template<typename Ostream, typename Cont>
typename enable_if<is_same<Ostream,ostream>::value, Ostream&>::type operator<<(Ostream& os,  const Cont& v){
	os<<"[";
	for(auto& x:v){os<<x<<", ";}
	return os<<"]";
}
template<typename Ostream, typename ...Ts>
Ostream& operator<<(Ostream& os,  const pair<Ts...>& p){
	return os<<"{"<<p.first<<", "<<p.second<<"}";
}

typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;
ll mul(ll a,ll b){return (a*b)%F;}
ll add(ll a,ll b){return (a+b)%F;}
ll sub(ll a,ll b){return ((a-b)%F+F)%F;}
void upd(ll &a,ll b){a=(a%F+b%F)%F;}
inline int read()
{
	int x=0,f=1; char ch=getchar();
	while(!isdigit(ch)) {if (ch=='-') f=-1; ch=getchar();}
	while(isdigit(ch)) { x=x*10+ch-'0'; ch=getchar();}
	return x*f;
} 
int main()
{
//	freopen("A.in","r",stdin);
//	freopen(".out","w",stdout);
	int n;
	cin>>n;
	if(n==1) puts("walk");
	else if(n==2 || n==3 || n==4 ) puts("no");
	else if(n==5|| n==6) puts("yes");
	else if(n==7) puts("backwards");
	else puts("7");
	return 0;
}

E Shortest Paths

You are given a graph of n n n nodes and m m m undirected edges. Find the shortest path from node 1 1 1 to each node with Dikjstra's algorithm.

Input

The first line contains two integers n n n and m m m ( 2 ≤ n ≤ 100 , 0 ≤ m ≤ n ( n − 1 ) 2 ) (2 \leq n \leq 100, 0 \leq m \leq \frac{n(n-1)}{2}) (2≤n≤100,0≤m≤2n(n−1)).

The following m m m lines contain 3 3 3 integers each: u u u, v v v, and w w w, denoting an undirected edge from u u u to v v v with weight w w w ( 1 ≤ u , v ≤ n , 0 ≤ w ≤ 10 5 ) (1 \leq u, v \leq n, 0 \leq w \leq 10^5) (1≤u,v≤n,0≤w≤105).

Output

Output the shortest path from node 1 1 1 to each node 2 , ... , n 2, \dots, n 2,...,n. If a node is not reachable from node 1 1 1, output − 1 -1 −1.

仔细阅读题面,发现数据范围可以用floyd(但还是错)

继续仔细看Dikjstra's 的拼写 D-ikj-stras 发现这里有拼写错误,所以把floyd的3层循环顺序换成ikj。

cpp 复制代码
#include<bits/stdc++.h> 
 
using namespace std;
#define For(i,n) for(int i=1;i<=n;i++)
#define Fork(i,k,n) for(int i=k;i<=n;i++)
#define ForkD(i,k,n) for(int i=n;i>=k;i--)
#define Rep(i,n) for(int i=0;i<n;i++)
#define ForD(i,n) for(int i=n;i;i--)
#define RepD(i,n) for(int i=n;i>=0;i--)
#define Forp(x) for(int p=pre[x];p;p=next[p])
#define Forpiter(x) for(int &p=iter[x];p;p=next[p])  
#define Lson (o<<1)
#define Rson ((o<<1)+1)
#define MEM(a) memset(a,0,sizeof(a));
#define MEMI(a) memset(a,0x3f,sizeof(a));
#define MEMi(a) memset(a,128,sizeof(a));
#define MEMx(a,b) memset(a,b,sizeof(a));
#define INF (1000000007)
#define F (1000000007)
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define vi vector<int> 
#define pi pair<int,int>
#define SI(a) ((a).size())
#define Pr(kcase,ans) printf("Case #%d: %lld\n",kcase,ans);
#define PRi(a,n) For(i,n-1) cout<<a[i]<<' '; cout<<a[n]<<endl;
#define PRi2D(a,n,m) For(i,n) { \
						For(j,m-1) cout<<a[i][j]<<' ';\
						cout<<a[i][m]<<endl; \
						} 
#pragma comment(linker, "/STACK:102400000,102400000")
#define ALL(x) (x).begin(),(x).end()
#define gmax(a,b) a=max(a,b);
#define gmin(a,b) a=min(a,b);
#ifdef DEBUG
#define _GLIBCXX_DEBUG
#endif
 
#define DEBUG
int recur_depth = 0;
#ifdef DEBUG
#define dbg(x) {++recur_depth; auto x_=x; --recur_depth; cerr<<string(recur_depth, '\t')<<"\e[91m"<<__func__<<":"<<__LINE__<<"\t"<<#x<<" = "<<x_<<"\e[39m"<<endl;}
#else
#define dbg(x)
#endif
template<typename Ostream, typename Cont>
typename enable_if<is_same<Ostream,ostream>::value, Ostream&>::type operator<<(Ostream& os,  const Cont& v){
	os<<"[";
	for(auto& x:v){os<<x<<", ";}
	return os<<"]";
}
template<typename Ostream, typename ...Ts>
Ostream& operator<<(Ostream& os,  const pair<Ts...>& p){
	return os<<"{"<<p.first<<", "<<p.second<<"}";
}
 
typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;
ll mul(ll a,ll b){return (a*b)%F;}
ll add(ll a,ll b){return (a+b)%F;}
ll sub(ll a,ll b){return ((a-b)%F+F)%F;}
void upd(ll &a,ll b){a=(a%F+b%F)%F;}
inline int read()
{
	int x=0,f=1; char ch=getchar();
	while(!isdigit(ch)) {if (ch=='-') f=-1; ch=getchar();}
	while(isdigit(ch)) { x=x*10+ch-'0'; ch=getchar();}
	return x*f;
} 
int main()
{
//	freopen("A.in","r",stdin);
//	freopen(".out","w",stdout);
	int n=read(),m=read();
	vector<vector<int> > f(120,vector<int>(120,INF));
	Rep(i,m) {
		int u=read(),v=read(),w=read();--u,--v;
		f[u][v]=min(f[u][v],w);
		f[v][u]=min(f[v][u],w);
	}
    Rep(i,n) f[i][i]=0;
	Rep(i,n) Rep(k,n) Rep(j,n) gmin(f[i][j],f[i][k]+f[k][j])
	
	For(j,n-1) {
		if(f[0][j]==INF) cout<<-1<<endl;
		else cout<<f[0][j]<<endl;
	}
	
	return 0;
}
 

J Special Problem

唯一还算trick的题,你需要回答一系列验证码问题。

题本身正常,除了一个德语路标误导比较强(你需要知道是字的那部分才是禁止符号),还有一个worddle(你需要玩一会儿才会发现它根本不限制词汇表),其它还好。

相关推荐
阿里云大数据AI技术1 小时前
基于 EMR Serverless Ray 实现 Qwen 模型批量推理实践
人工智能·算法·agent
Rambo.xia2 小时前
为什么去马赛克算法,决定了ISP的画质上限
算法·接口隔离原则
Benny_Tang2 小时前
题解:P10230 [COCI 2023/2024 #4] Lepeze
c++·算法
Geek-Chow2 小时前
06 训练管线:数据如何变成权重
人工智能·算法
我变成萤火虫3 小时前
反悔贪心(经典题目讲解)
c++·算法·贪心算法·stl·排序算法·反悔贪心
_Narcissus_3 小时前
排序算法总结表格
c语言·数据结构·c++·笔记·算法·排序算法·总结
一只小小的芙厨4 小时前
前缀和与差分
数据结构·算法
船厂电气自动化ai大模型4 小时前
AI大模型与数学第42课:泰勒级数完整展开(神经网络近似核心)
人工智能·python·深度学习·算法·机器学习