QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#603984#8780. Training, Round 2LEFt_bankWA 23ms107108kbC++20783b2024-10-01 21:36:222024-10-01 21:36:24

Judging History

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

  • [2024-10-01 21:36:24]
  • 评测
  • 测评结果:WA
  • 用时:23ms
  • 内存:107108kb
  • [2024-10-01 21:36:22]
  • 提交

answer

#include <bits/stdc++.h>
#define gc getchar
#define pc putchar
using namespace std;
typedef long long ll;
const int maxn=5145;

int n,x,y,dp[maxn][maxn];

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);

	cin>>n>>x>>y;
	__builtin_memset(dp,-1,sizeof(dp));
	dp[0][0]=0;
	for(int i=1;i<=n;i++) {
		int lx,rx,ly,ry;
		cin>>lx>>rx>>ly>>ry;
		lx-=x,rx-=x,ly-=y,ry-=y;
		for(int j=0;j<=i;j++) {
			dp[i][j]=dp[i-1][j];
			if(j>lx&&j-1<=rx&&dp[i-1][j-1]>=ly&&dp[i-1][j-1]<=ry)dp[i][j]=max(dp[i][j],dp[i-1][j-1]);
			if(j>=lx&&j<=rx&&dp[i-1][j]>=ly&&dp[i-1][j]<=ry)dp[i][j]=max(dp[i][j],dp[i-1][j]+1);
		}
	}
	
	int ans=0;
	for(int i=0;i<=n;i++) {
		if(dp[n][i]>=0) {
			ans=max(ans,dp[n][i]+i);
		}
	}
	cout<<ans;

  return 0;
}

詳細信息

Test #1:

score: 100
Accepted
time: 9ms
memory: 107076kb

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: 16ms
memory: 106976kb

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: 12ms
memory: 107108kb

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: 23ms
memory: 107016kb

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: 12ms
memory: 107088kb

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'