QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#564586#7875. Queue SortingliuhengxiWA 0ms1488kbC++141.0kb2024-09-15 10:43:042024-09-15 10:43:05

Judging History

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

  • [2024-09-15 10:43:05]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:1488kb
  • [2024-09-15 10:43:04]
  • 提交

answer

// created:  2024-09-15 10:34:58
#include<cstdio>
#include<cctype>
#include<cstring>
#include<algorithm>
#define F(i,l,r) for(int i=(l),i##_end=(r);i<i##_end;++i)
#define I128 //||is_same<T,__int128_t>::value||is_same<T,__uint128_t>::value
using namespace std;
template<typename T>enable_if_t<is_integral<T>::value I128,void> readmain(T &x)
{
	bool neg=false;int c=getchar();
	for(;!isdigit(c);c=getchar())if(c=='-')neg=true;
	for(x=0;isdigit(c);c=getchar())x=(T)(10*x+(c-'0'));
	if(neg)x=-x;
}
template<typename T>T& read(T &x){readmain(x);return x;}
template<typename T,typename ...Tr>void read(T &x,Tr&... r){readmain(x);read(r...);}
constexpr int N=505,MOD=998244353;
void reduce(int &x){(x>=MOD)&&(x-=MOD);}
int n,a[N],m,ans,f[N],g[N];
int main()
{
	read(n);
	f[0]=1;
	F(i,0,n)
	{
		read(a[i]);
		F(j,0,a[i])for(int k=m++;~k;--k)reduce(g[k+a[i]-j]+=f[k]),reduce(f[k]+=f[k+1]);
		f[0]=g[0];
		F(j,1,m+1)reduce(f[j]+=g[j]);
		memset(g,0,sizeof(int)*(m+1));
	}
	F(i,0,m+1)reduce(ans+=f[i]);
	printf("%d\n",ans);
	return 0;
}

详细

Test #1:

score: 100
Accepted
time: 0ms
memory: 1472kb

input:

4
1 1 1 1

output:

14

result:

ok 1 number(s): "14"

Test #2:

score: -100
Wrong Answer
time: 0ms
memory: 1488kb

input:

300
0 5 2 2 1 0 3 2 2 5 2 1 1 2 1 3 2 3 2 0 0 0 0 1 2 2 3 0 2 2 3 2 0 2 3 0 6 0 0 2 0 1 3 2 1 1 1 3 4 0 1 0 4 1 1 1 1 1 1 2 3 2 1 2 3 2 3 0 5 3 3 2 0 1 1 0 2 1 1 2 0 0 2 1 1 3 2 2 1 2 1 3 0 3 0 1 2 2 0 5 0 2 2 0 0 0 1 2 1 4 2 1 1 0 3 0 2 0 3 1 1 2 0 2 1 1 0 2 0 1 2 2 3 3 1 1 1 1 0 1 3 3 1 0 2 2 4 2 ...

output:

0

result:

wrong answer 1st numbers differ - expected: '507010274', found: '0'