QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#808155#8780. Training, Round 2xzf_200906WA 37ms101652kbC++14709b2024-12-10 17:27:362024-12-10 17:27:36

Judging History

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

  • [2024-12-10 17:27:36]
  • 评测
  • 测评结果:WA
  • 用时:37ms
  • 内存:101652kb
  • [2024-12-10 17:27:36]
  • 提交

answer

#include<bits/stdc++.h>
#define LL long long
using namespace std;
int f[5005][5005],al[5005],ar[5005],bl[5005],br[5005];
signed main(){
	ios::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
	int n,as,bs;
	cin>>n>>as>>bs;
	for(int i=1;i<=n;i++) cin>>al[i]>>ar[i]>>bl[i]>>br[i];
	memset(f,-0x3f,sizeof(f));
	f[0][0]=0;
	for(int i=0;i<n;i++){
		for(int j=0;j<=n;j++){
			int ac=as+j,bc=bs+f[i][j];
			if(al[i+1]<=ac&&ac<=ar[i+1]&&bl[i+1]<=bc&&bc<=br[i+1]){
				f[i+1][j]=max(f[i+1][j],f[i][j]+1);
				f[i+1][j+1]=max(f[i+1][j+1],f[i][j]);
			}
			else f[i+1][j]=max(f[i+1][j],f[i][j]);
		}
	}
	int ans=0;
	for(int i=0;i<=n;i++) ans=max(ans,i+f[n][i]);
	cout<<ans<<'\n';
	return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 4ms
memory: 101504kb

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: 0
Accepted
time: 26ms
memory: 101652kb

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:

5000

result:

ok single line: '5000'

Test #3:

score: 0
Accepted
time: 32ms
memory: 101584kb

input:

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

output:

5000

result:

ok single line: '5000'

Test #4:

score: 0
Accepted
time: 37ms
memory: 101592kb

input:

5000 76836128 716580777
76836128 76836128 716580777 716580777
76836129 76836129 716580777 716580777
76836130 76836130 716580777 716580777
76836131 76836131 716580777 716580777
76836131 76836131 716580778 716580778
76836131 76836131 716580779 716580779
76836131 76836131 716580780 716580780
76836128 7...

output:

4994

result:

ok single line: '4994'

Test #5:

score: -100
Wrong Answer
time: 27ms
memory: 101592kb

input:

5000 716580777 76836128
716580777 716580777 76836128 76836128
716580777 716580777 76836129 76836129
716580777 716580777 76836130 76836130
716580777 716580777 76836131 76836131
716580778 716580778 76836131 76836131
716580779 716580779 76836131 76836131
716580780 716580780 76836131 76836131
716580778 ...

output:

7

result:

wrong answer 1st lines differ - expected: '4994', found: '7'