【比赛报告】2018.10.24校赛[长乐一中Day1] NOIP练习赛卷二十一

本文是作者关于2018年10月24日长乐一中NOIP练习赛的赛后总结。在T1题目中,作者反思了过于复杂的思考方式,指出简单枚举即可解决问题。T2题目初版使用DP错误,T3题目感到困惑。作者意识到自己可能在技术提升上存在不足,感到与他人的差距,并表达了自我提升的决心。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

在这里插入图片描述


在这里插入图片描述

#include<cstdio>
#include<cstring>
#include<algorithm>
using namespace std;
const int N=3e4+10,M=5e2+10,sed=31,SED=131,mod=70177,MOD=92311;
int n,m,p,q,ans,tot,hd[mod],nx[N*2],ver[N*2],cnt[N*2],Hash[N],HASH[N];
struct node{
	char s[M];
	inline bool operator<(const node&rhs)const{
	return strcmp(s,rhs.s)<0;}
}a[N];
inline void Insert(const int &x,const int &y)
{
	for(int i=hd[x];i;i=nx[i])
	    if(ver[i]==y){++cnt[i];return;}
	nx[++tot]=hd[x];hd[x]=tot;ver[tot]=y;cnt[tot]=1;
	return;
}
inline int query(const int &x,const int &y)
{
	for(int i=hd[x];i;i=nx[i])
	    if(ver[i]==y)return cnt[i];
	return 0;
}
inline void solve1()
{
	int tmp,TMP;ans=-1;
	for(int i=0;i<n;i++)
	{
		tmp=TMP=0;
		for(int j=0;j<m;j++)
		{
			tmp=(tmp*sed+(a[i].s[j]=='N'))%mod;
			TMP=(TMP*SED+(a[i].s[j]=='N'))%MOD;
		}
		Hash[i]=tmp,HASH[i]=TMP;
		Insert(tmp,TMP);
	}
	for(int i=0;i<n;i++)
	    if(query(Hash[i],HASH[i])==p)//当成满分有p个 
	    {
	    	tmp=TMP=0;
	    	for(int j=0;j<m;j++)//求出零分答案 
	    	{
	    		tmp=(tmp*sed+(a[i].s[j]=='Y'))%mod;
	    		TMP=(TMP*SED+(a[i].s[j]=='Y'))%MOD;
			}
			if(query(tmp,TMP)=
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值