QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#72273#4812. Counting SequenceJinTianHaoCompile Error//C++171.7kb2023-01-15 11:49:072023-01-15 11:49:39

Judging History

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

  • [2023-08-10 23:21:45]
  • System Update: QOJ starts to keep a history of the judgings of all the submissions.
  • [2023-01-15 11:49:39]
  • 评测
  • [2023-01-15 11:49:07]
  • 提交

answer

#include <bits/stdc++.h>
#define inf 1000000007
#define mod 998244353
// #define int long long
// #pragma GCC optimize("Ofast","inline","-ffast-math")
// #pragma GCC target("avx,sse2,sse3,sse4,mmx")
using namespace std;
template <typename T> void read(T &x){
	x=0;char ch=getchar();int fh=1;
	while (ch<'0'||ch>'9'){if (ch=='-')fh=-1;ch=getchar();}
	while (ch>='0'&&ch<='9')x=x*10+ch-'0',ch=getchar();
	x*=fh;
}
template <typename T> void write(T x) {
	if (x<0) x=-x,putchar('-');
	if (x>9) write(x/10);
	putchar(x%10+'0');
}
template <typename T> void writeln(T x) {
	write(x);
	puts("");
}
int n,c,siz,ans;
int dp[1000][600005];
signed main()
{
	// freopen(".in","r",stdin);
	// freopen(".out","w",stdout);
	read(n);read(c);
	siz=sqrt(2*n)-10;siz=max(siz,0);
	while((siz+2)*(siz+1)<=2*n) ++siz;
	dp[1][n]=1;
	for(int i=1;i<siz;++i)
	{
		for(int j=0;j<=2*n;++j)
			dp[i&1^1][j]=0;
		for(int j=0;j<=2*n;++j)
		{
			//add <
			if(j+i<=2*n) (dp[i&1^1][j+i]+=dp[i&1][j])%=mod;
			//add >
			if(j-i>=0) (dp[i&1^1][j-i]+=1ll*c*dp[i&1][j]%mod)%=mod;
		}
		for(int a=siz+1;a<=n;++a)
		{
			int sum=2*n-1ll*a*i;
			if(sum>=0&&sum<=2*n) (ans+=dp[i&1][sum])%=mod;
		}
	}
	for(int a=siz+1;a<=n;++a)
		for(int m=siz;m<=siz;++m)
		{
			int sum=2*n-1ll*a*m;
			if(sum>=0&&sum<=2*n) (ans+=dp[m&1][sum])%=mod;
		}
	for(int i=0;i<=2*n;++i)
		dp[siz&1][i]=0;
	for(int i=1;i<=n;++i)
	{
		if(i<=siz) (dp[i][i]+=1)%=mod;
		for(int j=1;j<1000;++j)
		{
			if(!dp[j][i]) continue;
			if(i+j-1<=n&&j>1) (dp[j-1][i+j-1]+=1ll*c*dp[j][i]%mod)%=mod;
			if(i+j+1<=n&&j<999) (dp[j+1][i+j+1]+=dp[j][i])%=mod;
		}
	}
	for(int i=1;i<1000;++i)
		(ans+=dp[i][n])%=mod;
	writeln(ans);
	return 0;
}

详细

/tmp/ccuIdCF8.o: in function `main':
answer.code:(.text.startup+0x9): relocation truncated to fit: R_X86_64_PC32 against symbol `n' defined in .bss section in /tmp/ccuIdCF8.o
answer.code:(.text.startup+0x21): relocation truncated to fit: R_X86_64_PC32 against symbol `c' defined in .bss section in /tmp/ccuIdCF8.o
answer.code:(.text.startup+0x2c): relocation truncated to fit: R_X86_64_PC32 against symbol `n' defined in .bss section in /tmp/ccuIdCF8.o
answer.code:(.text.startup+0x63): relocation truncated to fit: R_X86_64_PC32 against symbol `siz' defined in .bss section in /tmp/ccuIdCF8.o
answer.code:(.text.startup+0x8a): relocation truncated to fit: R_X86_64_PC32 against symbol `siz' defined in .bss section in /tmp/ccuIdCF8.o
answer.code:(.text.startup+0xcb): relocation truncated to fit: R_X86_64_PC32 against symbol `c' defined in .bss section in /tmp/ccuIdCF8.o
answer.code:(.text.startup+0xe1): relocation truncated to fit: R_X86_64_PC32 against symbol `ans' defined in .bss section in /tmp/ccuIdCF8.o
answer.code:(.text.startup+0x56a): relocation truncated to fit: R_X86_64_PC32 against symbol `ans' defined in .bss section in /tmp/ccuIdCF8.o
answer.code:(.text.startup+0x58b): relocation truncated to fit: R_X86_64_PC32 against symbol `ans' defined in .bss section in /tmp/ccuIdCF8.o
answer.code:(.text.startup+0x729): relocation truncated to fit: R_X86_64_PC32 against symbol `ans' defined in .bss section in /tmp/ccuIdCF8.o
answer.code:(.text.startup+0x764): additional relocation overflows omitted from the output
collect2: error: ld returned 1 exit status