QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#491689#8780. Training, Round 2daishuchen2010WA 28ms6716kbC++20882b2024-07-25 21:03:542024-07-25 21:03:55

Judging History

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

  • [2024-07-25 21:03:55]
  • 评测
  • 测评结果:WA
  • 用时:28ms
  • 内存:6716kb
  • [2024-07-25 21:03:54]
  • 提交

answer

#include <bits/stdc++.h>
using namespace std;
const int MAXN = 5e3 + 5;
int x,y;
bitset <MAXN> dp[MAXN],RNG,tmp;
//dp[i][j]means can (x,y) go to the point (x+i,y+j)
int main()
{
	ios::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
	int n;
	cin >> n >> x >> y;
	dp[0][0] = 1;
	for (int i = 1,xl,xr,yl,yr; i <= n; i++)
	{
		cin >> xl >> xr >> yl >> yr;
		xl -= x,xl = max(xl,0),yl -= y,yl = max(yl,0);
		xr -= x,xr = min(xr,n),yr -= y,yr = min(yr,n);
		RNG.set(),RNG >>= (yr + 1),RNG <<= (yr + 1);
		RNG.flip(),RNG >>= yl,RNG <<= yl;//!!!位置(yl+1)~(yr+1)
		for (int j = xr; j >= xl; j--)
		{
			tmp = (dp[j] & RNG);
			if (j < n) dp[j + 1] |= tmp;
			dp[j] |= (tmp << 1);
		}
	}
	int ans = 0;
	for (int i = 0; i <= n; i++)
	{
		for (int j = 0; j <= n; j++)
		{
			if (dp[i][j]) ans = max(ans,i + j);
		}
	}
	cout << ans << '\n';
	return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 0ms
memory: 3556kb

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: 28ms
memory: 5964kb

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: 21ms
memory: 5904kb

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

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: 21ms
memory: 6716kb

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: -100
Wrong Answer
time: 28ms
memory: 3620kb

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:

139

result:

wrong answer 1st lines differ - expected: '5', found: '139'