QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#490705#8780. Training, Round 2maojunWA 27ms5824kbC++23883b2024-07-25 16:10:132024-07-25 16:10:13

Judging History

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

  • [2024-07-25 16:10:13]
  • 评测
  • 测评结果:WA
  • 用时:27ms
  • 内存:5824kb
  • [2024-07-25 16:10:13]
  • 提交

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=0;i<n;i++){
		bool o=i&1;
		if(la[i+1]>ra[i+1]||lb[i+1]>rb[i+1])continue;
		for(int j=0;j<n;j++)dp[!o][j].reset();
		for(int j=0;j<n;j++){
			dp[!o][j]|=dp[o][j];
			if(la[i+1]<=j&&j<=ra[i+1]){
				bs tmp=dp[o][j];
				tmp>>=lb[i+1];
				tmp<<=N-rb[i+1]+lb[i+1]-1;
				tmp>>=N-rb[i+1]-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: 5824kb

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: 27ms
memory: 3960kb

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'