QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#202838#2482. Storage ProblemsBoulevardDust#WA 0ms3964kbC++201.0kb2023-10-06 13:42:412023-10-06 13:42:41

Judging History

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

  • [2023-10-06 13:42:41]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:3964kb
  • [2023-10-06 13:42:41]
  • 提交

answer

#include<bits/stdc++.h>
#define N 405
#define re 
#define ll long long
#define P 167772161
using namespace std;
int n,m,K,q,T;
inline void Rd(int &res){
	re char c;res=0;
	while(c=getchar(),c<48);
	do res=(res<<3)+(res<<1)+(c^48);
	while(c=getchar(),c>47);
}
int a[N],f[N][N],g[N][N];
inline void Mod(int &x){x>=P&&(x-=P);}
int main(){
	Rd(n),Rd(K);
	for(re int i=1;i<=n;i++)Rd(a[i]);
	f[0][0]=1;
	for(re int i=1;i<=n;i++){
		for(re int j=0;j<=i;j++)
			for(re int k=0;k<=K;k++){
				Mod(g[j][k]+=f[j][k]);
				if(k>=a[i]&&j>0)Mod(g[j][k]+=f[j-1][k-a[i]]);
			}
		for(re int j=0;j<=i;j++)
			for(re int k=0;k<=K;k++)f[j][k]=g[j][k],g[j][k]=0;
	}
			
	
	for(re int i=1;i<=n;i++){
		for(re int j=0;j<=n;j++)
			for(re int k=0;k<=n;k++){
				g[j][k]=f[j][k];
				if(j>0&&k>=a[i])g[j][k]-=g[j-1][k-a[i]];
				g[j][k]<0&&(g[j][k]+=P);
			}
		for(re int j=1;j<n;j++){
			int res=0;
			for(re int k=K-a[i]+1;k<=K;k++)Mod(res+=g[j][k]);
			printf("%d",res);
			putchar(j==n-1?'\n':' ');
			
		}
	}
	
	
	
	
	
	
	return 0;
}

详细

Test #1:

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

input:

3 2
1 1 2

output:

1 0
1 0
2 1

result:

ok 3 lines

Test #2:

score: 0
Accepted
time: 0ms
memory: 3964kb

input:

3 3
2 2 1

output:

1 1
1 1
0 0

result:

ok 3 lines

Test #3:

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

input:

3 6
6 5 2

output:

1 0
1 0
0 0

result:

wrong answer 1st lines differ - expected: '2 0', found: '1 0'