QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#188682#1093. Bookcase Solidity UnitedZSH_ZSHWA 0ms7488kbC++141.1kb2023-09-26 11:13:592023-09-26 11:13:59

Judging History

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

  • [2023-09-26 11:13:59]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:7488kb
  • [2023-09-26 11:13:59]
  • 提交

answer

#include<bits/stdc++.h>
#define rep(i,a,b) for (register int i=(a);i<=(b);i++)
#define drep(i,a,b) for (register int i=(a);i>=(b);i--)
typedef long long ll;
using namespace std;

template<typename T1,typename T2> inline void chkmin(T1 &x,const T2 &y){x=(x<y)?x:y;}
template<typename T1,typename T2> inline void chkmax(T1 &x,const T2 &y){x=(x>y)?x:y;}

const int N=75,M=160,lim=150;

int n,a[N],f[N][N][M];

void solve()
{
	cin>>n;
	rep(i,1,n) cin>>a[i];
	 
	memset(f,0x3f,sizeof(f));
	rep(i,1,n) f[i][i][a[i]/2]=a[i];
	
	rep(len,2,n) rep(l,1,n-len+1)
	{
		int r=l+len-1;
		rep(v,0,lim) chkmin(f[l][r][max(v,a[r])/2],f[l][r-1][v]+max(0,a[r]-v));
		rep(k,l,r-1)
		{
			rep(v0,0,lim) if (f[l][k][v0]<1e9) rep(v1,0,lim-v0) if (f[k+1][r][v1]<1e9)
			{
				chkmin(f[l][r][v0+v1],f[l][k][v0]+f[k+1][r][v1]);
			} 
		}
	}
	
	rep(i,1,n)
	{
		int ans=1e9;
		rep(j,0,lim) chkmin(ans,f[1][i][j]);
		printf("%d ",ans);
	}
	printf("\n");
}

int main()
{
	ios::sync_with_stdio(false); cin.tie(0);
	
	int sid,T; cin>>sid>>T;
	while (T--) solve();
	
	return 0;
}

详细

Test #1:

score: 0
Wrong Answer
time: 0ms
memory: 7488kb

input:

3
8 1 2

output:

2 
2 
2 
2 
2 
2 
2 
2 

result:

wrong answer 1st numbers differ - expected: '8', found: '2'