QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#519104#1833. DeletingThe_Shadow_DragonCompile Error//C++14910b2024-08-14 16:22:062024-08-14 16:22:06

Judging History

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

  • [2024-08-14 16:22:06]
  • 评测
  • [2024-08-14 16:22:06]
  • 提交

answer

#include<bits/stdc++.h>
using namespace std;
#define ll long long 
#define ull unsigned long long
#define sort stable_sort 
#define endl '\n'
int cost[4010][4010];
bitset<4010>f[4010];
bool check(int mid,int n)
{
	for(int i=1;i<=n;i++)
	{
		f[i].reset();
		f[i][i-1]=1;
	}
	for(int l=n;l>=1;l--)
	{
		for(int r=l+1;r<=n;r+=2)
		{
			f[l][r]=f[l][r]|(f[l+1][r-1]==1&&cost[l][r]<=mid);
			if(f[l][r]==1)
			{
				for(int s=f[r+1]._Find_first();s!=f[r+1].size();s=f[r+1]._Find_next(k))
				{
					f[l][s]=1;
				}
			}
		}
	}
	return (f[1][n]==1);
}
int main()
{
	int n,i,j,l=1,r,mid,ans=0;
	scanf("%d",&n);
	r=n*n/4;
	for(i=1;i<=n-1;i++)
	{
		for(j=i+1;j<=n;j+=2)
		{
			scanf("%d",&cost[i][j]);
		}
	}
	while(l<=r)
	{
		mid=(l+r)/2;
		if(check(mid,n)==true)
		{
			ans=mid;
			r=mid-1;
		}
		else
		{
			l=mid+1;
		}
	}
	printf("%d\n",ans);
	return 0;
}

Details

answer.code: In function ‘bool check(int, int)’:
answer.code:23:101: error: ‘k’ was not declared in this scope
   23 |                                 for(int s=f[r+1]._Find_first();s!=f[r+1].size();s=f[r+1]._Find_next(k))
      |                                                                                                     ^
answer.code: In function ‘int main()’:
answer.code:35:14: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   35 |         scanf("%d",&n);
      |         ~~~~~^~~~~~~~~
answer.code:41:30: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   41 |                         scanf("%d",&cost[i][j]);
      |                         ~~~~~^~~~~~~~~~~~~~~~~~