QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#490978#8780. Training, Round 2czcWA 21ms24352kbC++23732b2024-07-25 16:56:052024-07-25 16:56:05

Judging History

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

  • [2024-07-25 16:56:05]
  • 评测
  • 测评结果:WA
  • 用时:21ms
  • 内存:24352kb
  • [2024-07-25 16:56:05]
  • 提交

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=j,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;
}

详细

Test #1:

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

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: 19ms
memory: 14752kb

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: 19ms
memory: 13788kb

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: 14ms
memory: 4244kb

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

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:

4997

result:

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