QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#490935#8780. Training, Round 2czcWA 17ms4052kbC++23734b2024-07-25 16:47:492024-07-25 16:47:51

Judging History

This is the latest submission verdict.

  • [2024-07-25 16:47:51]
  • Judged
  • Verdict: WA
  • Time: 17ms
  • Memory: 4052kb
  • [2024-07-25 16:47:49]
  • Submitted

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+1);
				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: 0ms
memory: 4032kb

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: 4052kb

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'