欢乐纪中A组周六赛【2019.3.23】

版权声明:原创,未经作者允许禁止转载 https://blog.csdn.net/Mr_wuyongcong/article/details/88759424

前言

做A组被虐好惨


成绩

R a n k Rank 是有算别人的

R a n k Rank P e r s o n Person S c o r e Score A A B B C C
13 13 2017 W Y C 2017WYC 190 190 90 90 100 100 0 0
19 19 2017 H Z B 2017HZB 110 110 100 100 10 10 0 0
27 27 2017 X J Q 2017XJQ 100 100 100 100 0 0 0 0
42 42 2017 X X Y 2017XXY 40 40 20 20 20 20 0 0
44 44 2017 L W 2017LW 30 30 20 20 10 10 0 0
44 44 2017 L R Z 2017LRZ 30 30 20 20 10 10 0 0
48 48 2017 Z Y C 2017ZYC 20 20 20 20 0 0 0 0
54 54 2017 H J Q 2017HJQ 10 10 0 0 10 10 0 0

正题


T 1 : j z o j 4671 W o r l d T o u r T1: jzoj4671-World Tour 【图论 , b f s ,bfs

链接:
https://blog.csdn.net/Mr_wuyongcong/article/details/88758950


T 2 : j z o j 4672 G r a p h C o l o r i n g T2:jzoj4672-Graph Coloring 【图论 , , 模拟】

链接:
https://blog.csdn.net/Mr_wuyongcong/article/details/88758992


T 3 : j z o j 4673 , C F 578 D L C S a g a i n T3:jzoj4673,CF578D-LCS again 【统计,字符串 , , 容斥】

链接:
https://blog.csdn.net/Mr_wuyongcong/article/details/88759105


s o m e   o f   c o d e some\ of\ code


T 2   30   c o d e T2\ 30分\ code

#include<cstdio>
#include<algorithm>
#include<cstring>
using namespace std;
struct edge{
	int x,y,w;
}a[50];
int n,m,MS,ans;
int count_one(int x)
{
	int ans=0;
	while(x){
		ans++;
		x-=(x&-x);
	}
	return ans;
}
int main()
{
	scanf("%d%d",&n,&m);
	if(n>20||m>20){
		printf("-1");
		return 0;
	}
	for(int i=1;i<=m;i++)
	{
		char c;
		scanf("%d %d %c",&a[i].x,&a[i].y,&c);
		a[i].x--;a[i].y--;
		a[i].w=(c=='R');
	}
	MS=1<<n;ans=233333;
	for(int i=0;i<MS;i++)
	{
		bool flag=0;
		for(int j=1;j<=m;j++)
		  if((((i>>a[j].x)&1)+((i>>a[j].y)&1))%2!=a[j].w){
		  	flag=1;break;
		  }
		if(flag) continue;
		ans=min(ans,count_one(i));
	}
	for(int i=0;i<MS;i++)
	{
		bool flag=0;
		for(int j=1;j<=m;j++)
		  if((((i>>a[j].x)&1)+((i>>a[j].y)&1))%2==a[j].w){
		  	flag=1;break;
		  }
		if(flag) continue;
		ans=min(ans,count_one(i));
	}
	if(ans>n) printf("-1");
	else printf("%d",ans);
}

总结

看题预估分 30 + 30 + 0 = 60 30+30+0=60
做题预估分 50 + 100 + 0 = 150 50+100+0=150
实际分数 90 + 100 + 0 = 190 90+100+0=190
T 1 T1 开始不会,后来发现可以枚举中间两个点,结果忘记特判凉掉。
T 2 T2 开始不会,写了个暴力,然后突然发现了一个神奇的性质,切掉。
T 3 T3 是啥???


尾声

% % % H J W   a n d   Z Z Y \%\%\%HJW\ and\ ZZY

猜你喜欢

转载自blog.csdn.net/Mr_wuyongcong/article/details/88759424
今日推荐