CSP-S 蒟蒻啊qaq

CSP-S 2021

  • 蒟蒻啊QAQ
    • 1、[P7913 [CSP-S 2021] 廊桥分配](https://www.luogu.com.cn/problem/P7913)
    • 2、[P7914 [CSP-S 2021] 括号序列](https://www.luogu.com.cn/problem/P7914)
    • 3、[P7915 [CSP-S 2021] 回文](https://www.luogu.com.cn/problem/P7915)
    • 4、[P7916 [CSP-S 2021] 交通规划](https://www.luogu.com.cn/problem/P7916)
    • 总结:20pts waaaa qaq ... 少年继续努力吧。

蒟蒻啊QAQ

当黎明的钟声敲响,CSP落下帷幕。 ——某血统纯正的蒟蒻qaq,

1、P7913 [CSP-S 2021] 廊桥分配

#include

using namespace std;

const int N=1e5+10;

struct node{
	int l,r;
};

int n,m1,m2,ans=0;//m1,a国内   m2,b国际 
node a[N],b[N]; 


bool f(node xx,node yy){
	if(xx.l!=yy.l) return xx.l<yy.l;
	else return xx.r<yy.r; 
}

int find1(int x){
	if(x==0) return 0;
	int q[N],l=0,r=0,tot=0;
	memset(q,0,sizeof(q));
	q[1]=1;tot++;l++;r++;
	for(int i=2;i<=m1;i++){
		for(int j=l;j<=r;j++){
			if(a[q[j]].r<a[i].l){
				swap(q[j],q[l]);
				l++;
			}
		}
		if((r-l+1)<x){
			r++;q[r]=i;
			tot++;
		}
	}
	return tot;
}

int find2(int x){
	if(x==0) return 0;
	int q[N],l=0,r=0,tot=0;
	memset(q,0,sizeof(q));
	q[1]=1;tot++;l++;r++;
	for(int i=2;i<=m2;i++){
		for(int j=l;j<=r;j++){
			if(b[q[j]].r<b[i].l){
				swap(q[j],q[l]);
				l++;
			}
		}
		if((r-l+1)<x){
			r++;q[r]=i;
			tot++;
		}
	}
	return tot;
}

int main(){
	freopen("airport.in","r",stdin);
	freopen("airport.out","w",stdout);
	scanf("%d%d%d",&n,&m1,&m2);
	for(int i=1;i<=m1;i++){scanf("%d%d",&a[i].l,&a[i].r);}
	for(int i=1;i<=m2;i++){scanf("%d%d",&b[i].l,&b[i].r);}
	sort(a+1,a+m1+1,f);
	sort(b+1,b+m2+1,f);
	for(int i=0;i<=n;i++){
		int x1=find1(i);
		int x2=find2(n-i);
		ans=max(ans,x1+x2);
	}
	printf("%d",ans);
	return 0;
}

得分:20pts(洛谷民间数据)

想法:极为朴素的暴力。。。

2、P7914 [CSP-S 2021] 括号序列

3、P7915 [CSP-S 2021] 回文

4、P7916 [CSP-S 2021] 交通规划

总分:20+0+0+0=20
(三颗水煮蛋。。。)

总结:20pts waaaa qaq … 少年继续努力吧。

|
|
|
|
|
|
|
|
|
|
|
在三颗水煮蛋的压迫下,蒟蒻成功地在NOIP中压线1=???
运气守恒定律诚不欺我!!!!!!

你可能感兴趣的:(比赛,1024程序员节)