QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#490890#8780. Training, Round 2yqh2025WA 13ms6140kbC++141.3kb2024-07-25 16:39:422024-07-25 16:39:42

Judging History

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

  • [2024-07-25 16:39:42]
  • 评测
  • 测评结果:WA
  • 用时:13ms
  • 内存:6140kb
  • [2024-07-25 16:39:42]
  • 提交

answer

#include<bits/stdc++.h>
using namespace std;
#define int long long
const int N=5010;
int n,a,b;
int la[N],ra[N],lb[N],rb[N];
int f[N][N];
set<int>s[N];
void solve(int l,int r,int id){
	set<int>::iterator it=s[id].lower_bound(l);
	vector<int>ve;
	for(;it!=s[id].end()&&(*it)<=r;it++){
		int x=*it;ve.push_back(x+1);
		f[id][x+1]=f[id+1][x]=1;
		s[id+1].insert(x);
	}
	while(1){
		it=s[id].lower_bound(l);
		if(it==s[id].end())break;
		if((*it)>r)break;
		s[id].erase(*it);
	}
	for(int x:ve)s[id].insert(x);
}
signed main(){
	scanf("%lld%lld%lld",&n,&a,&b);
	for(int i=1;i<=n;i++){
		scanf("%lld%lld%lld%lld",&la[i],&ra[i],&lb[i],&rb[i]);
		la[i]-=a,ra[i]-=a,lb[i]-=b,rb[i]-=b;
		la[i]=max(la[i],0ll),ra[i]=max(ra[i],0ll);
		lb[i]=max(lb[i],0ll),rb[i]=max(rb[i],0ll);
		la[i]=min(la[i],n),ra[i]=min(ra[i],n);
		lb[i]=min(lb[i],n),rb[i]=min(rb[i],n);
	}
	f[0][0]=1;s[0].insert(0);
	for(int t=1;t<=n;t++){
		int i=0;
		for(i=la[i];i<=ra[i];i++){
			solve(lb[i],rb[i],i);
		}
		// for(int i=0;i<=n;i++){
			// for(int j=0;j<=n;j++){
				// cout<<f[i][j]<<" ";
			// }
			// cout<<endl;
		// }
		// cout<<endl;
	}
	int ans=0;
	for(int i=0;i<=n;i++){
		for(int j=0;j<=n;j++){
			if(f[i][j])ans=max(ans,i+j);
		}
	}
	cout<<ans;
	return 0;
}

详细

Test #1:

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

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: 13ms
memory: 4064kb

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:

1

result:

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