QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#490941#8780. Training, Round 2czcWA 17ms4132kbC++23732b2024-07-25 16:48:442024-07-25 16:48:45

Judging History

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

  • [2024-07-25 16:48:45]
  • 评测
  • 测评结果:WA
  • 用时:17ms
  • 内存:4132kb
  • [2024-07-25 16:48:44]
  • 提交

answer

#include<bits/stdc++.h>
using namespace std;
int n,a,b;
int vis[5005][5005];
set<int> st[5005];
int main(){
	scanf("%d%d%d",&n,&a,&b);
	vis[0][0]=1;
	st[0].insert(0);
	for(int i=1;i<=n;i++){
		int la,ra,lb,rb;
		scanf("%d%d%d%d",&la,&ra,&lb,&rb);
		la-=a,ra-=a,lb-=b,rb-=b;
		for(int j=max(0,la);j<=min(n,ra);j++){
			auto it=st[j].lower_bound(lb);
			for(auto it2=it;it2!=st[j].end() && *it2<=rb; ){
				int x=i,y=*it2;
				it2=st[j].erase(it2);
				if(!vis[x+1][y]) vis[x+1][y]=1,st[x+1].insert(y);
				if(!vis[x][y+1]) vis[x][y+1]=1,st[x].insert(y+1);
			}
		}
	}
	int ans=0;
	for(int i=0;i<=n;i++){
		for(int j=0;j<=n;j++){
			if(vis[i][j]) ans=max(ans,i+j);
		}
	}
	printf("%d",ans);
	return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 1ms
memory: 4132kb

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: 17ms
memory: 4120kb

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:

5

result:

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