QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#490715#8780. Training, Round 2maojunWA 21ms5936kbC++23803b2024-07-25 16:12:562024-07-25 16:12:56

Judging History

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

  • [2024-07-25 16:12:56]
  • 评测
  • 测评结果:WA
  • 用时:21ms
  • 内存:5936kb
  • [2024-07-25 16:12:56]
  • 提交

answer

#include<bits/stdc++.h>
using namespace std;

const int N=5005;
int n,a,b,la[N],ra[N],lb[N],rb[N];

typedef bitset<N> bs;
bs dp[2][N];
int main(){
	scanf("%d%d%d",&n,&a,&b);
	for(int i=1;i<=n;i++){
		scanf("%d%d%d%d",&la[i],&ra[i],&lb[i],&rb[i]);
		la[i]=max(0,la[i]-a);
		ra[i]=min(n-1,ra[i]-a);
		lb[i]=max(0,lb[i]-b);
		rb[i]=min(n-1,lb[i]-b);
	}
	dp[0][0].set(0);
	for(int i=1;i<=n;i++){
		bool o=i&1;
		if(la[i]>ra[i]||lb[i]>rb[i])continue;
		for(int j=0;j<n;j++)dp[o][j]=dp[!o][j];
		for(int j=la[i];j<=ra[i];j++){
			bs tmp=dp[!o][j];
			tmp>>=lb[i];
			tmp<<=N-rb[i]+lb[i]-1;
			tmp>>=N-rb[i]-1;
			dp[o][j+1]|=tmp;dp[o][j]|=tmp<<1;
		}
	}
	int res=0;
	for(int j=0;j<n;j++)for(int k=0;k<n;k++)if(dp[n&1][j][k])res=max(res,j+k);
	printf("%d\n",res);
	return 0;
}

详细

Test #1:

score: 100
Accepted
time: 1ms
memory: 5936kb

input:

3 0 0
0 1 0 1
1 1 0 1
1 1 1 1

output:

3

result:

ok single line: '3'

Test #2:

score: -100
Wrong Answer
time: 21ms
memory: 3944kb

input:

5000 801577551 932138594
801577551 801577551 932138594 932138594
801577552 801577552 932138594 932138594
801577552 801577552 932138595 932138595
801577552 801577552 932138596 932138596
801577553 801577553 932138596 932138596
801577553 801577553 932138597 932138597
801577553 801577553 932138598 93213...

output:

0

result:

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