QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#638634#8780. Training, Round 2Su_ZipeiWA 63ms13176kbC++14812b2024-10-13 16:27:372024-10-13 16:27:38

Judging History

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

  • [2024-10-13 16:27:38]
  • 评测
  • 测评结果:WA
  • 用时:63ms
  • 内存:13176kb
  • [2024-10-13 16:27:37]
  • 提交

answer

#include<bits/stdc++.h>
using namespace std;
const int N=5010;
bitset<N> dp[N],tmpl[N],tmpr[N],tmp2,tmp;
int main(){
	int n=5000,a=0,b=0;
	scanf("%d%d%d",&n,&a,&b);
	dp[0][0]=1;
	for(int i=0;i<N;i++)
	for(int j=i;j<N;j++)
		tmpl[i][j]=1;
	for(int i=0;i<N;i++)
	for(int j=0;j<=i;j++)
		tmpr[i][j]=1;
	for(int i=1;i<=n;i++){
		int l1=0,r1=5000,l2=0,r2=5000;
		scanf("%d%d%d%d",&l1,&r1,&l2,&r2);
		l1-=a;r1-=a;l2-=b;r2-=b;
		l1=max(l1,0);
		r1=min(r1,n);
		l2=max(l2,0);
		r2=min(r2,n);
		tmp=tmpl[l2]&tmpr[r2];
		for(int j=r1;j>=l1;j--){
			tmp2=dp[j]&tmp;
			dp[j]|=tmp2<<1;
			dp[j+1]|=tmp2;
		}
	}
	int res=0;
	for(int i=0;i<=n;i++)
	for(int j=0;j<=n;j++)
		if(dp[i][j])res=max(res,i+j);
	printf("%d\n",res);
//	printf("%.20lf\n",(double)clock()/CLOCKS_PER_SEC);
	return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 33ms
memory: 11600kb

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: 59ms
memory: 12944kb

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: 60ms
memory: 12660kb

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: 56ms
memory: 11976kb

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: 0
Accepted
time: 62ms
memory: 13176kb

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:

4994

result:

ok single line: '4994'

Test #6:

score: 0
Accepted
time: 62ms
memory: 11228kb

input:

5000 774827789 700294316
774827790 774827791 700294315 700294317
774827789 774827790 700294317 700294318
774827789 774827790 700294316 700294316
774827787 774827787 700294315 700294316
774827789 774827791 700294315 700294318
774827787 774827789 700294317 700294318
774827787 774827788 700294314 70029...

output:

5

result:

ok single line: '5'

Test #7:

score: 0
Accepted
time: 60ms
memory: 11936kb

input:

5000 700294316 774827789
700294315 700294317 774827790 774827791
700294317 700294318 774827789 774827790
700294316 700294316 774827789 774827790
700294315 700294316 774827787 774827787
700294315 700294318 774827789 774827791
700294317 700294318 774827787 774827789
700294314 700294318 774827787 77482...

output:

5

result:

ok single line: '5'

Test #8:

score: 0
Accepted
time: 61ms
memory: 10720kb

input:

5000 256309650 340081224
256309647 256309649 340081224 340081227
256309645 256309650 340081226 340081229
256309652 256309652 340081219 340081220
256309645 256309655 340081222 340081226
256309646 256309648 340081221 340081225
256309651 256309654 340081219 340081221
256309651 256309653 340081219 34008...

output:

11

result:

ok single line: '11'

Test #9:

score: 0
Accepted
time: 58ms
memory: 10800kb

input:

5000 340081224 256309650
340081224 340081227 256309647 256309649
340081226 340081229 256309645 256309650
340081219 340081220 256309652 256309652
340081222 340081226 256309645 256309655
340081221 340081225 256309646 256309648
340081219 340081221 256309651 256309654
340081219 340081226 256309651 25630...

output:

11

result:

ok single line: '11'

Test #10:

score: -100
Wrong Answer
time: 63ms
memory: 10008kb

input:

5000 490966735 218892297
490966732 490966733 218892303 218892305
490966741 490966741 218892298 218892301
490966733 490966735 218892291 218892297
490966729 490966734 218892296 218892301
490966742 490966745 218892287 218892303
490966726 490966738 218892301 218892305
490966726 490966730 218892292 21889...

output:

43

result:

wrong answer 1st lines differ - expected: '21', found: '43'