QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#186268#1085. Brave Seekers of Unicornsyjf1225RE 0ms0kbC++14628b2023-09-23 15:47:292023-09-23 15:47:29

Judging History

你现在查看的是最新测评结果

  • [2023-09-23 15:47:29]
  • 评测
  • 测评结果:RE
  • 用时:0ms
  • 内存:0kb
  • [2023-09-23 15:47:29]
  • 提交

answer

#include<iostream>
#include<cstdio>
#include<algorithm>
#include<queue>

typedef long long LL;

using namespace std;

namespace yjf{
	const int N=1000010;
	
	LL f[N];
	
	int main(){
		int n,Mod;
		scanf("%d%d",&n,&Mod);
		
		LL ans=0;
		f[0]=1;
		for(int i=1;i<=n;i++){
			for(int j=0;j<i;j++){
				f[i]+=f[j];
				f[i]%=Mod;
				if((i^j)<j){
					f[i]-=f[i^j];
					f[i]=(f[i]%Mod+Mod)%Mod;
				}
			}
			ans+=f[i];
			ans%=Mod;
		}
		
		printf("%lld\n",ans);
		
		return 0;
	}
}

int main(){
	//freopen("xor.in","r",stdin);
	//freopen("xor.out","w",stdout);
	
	return yjf::main();
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 0
Runtime Error

input:

1

output:


result: