当前位置: 首页 > news >正文

网站建设费属于业务宣传费吗如何建立和设置公司网站

网站建设费属于业务宣传费吗,如何建立和设置公司网站,宁晋县建设局网站,中国建设集团门户网站题意#xff1a; 在这个城市里有两个黑帮团伙#xff0c;现在给出N个人#xff0c;问任意两个人他们是否在同一个团伙 1.输入D x y代表x于y不在一个团伙里 2.输入A x y要输出x与y是否在同一团伙或者不确定他们在同一个团伙里 题目#xff1a; The police office in Tadu…题意 在这个城市里有两个黑帮团伙现在给出N个人问任意两个人他们是否在同一个团伙 1.输入D x y代表x于y不在一个团伙里 2.输入A x y要输出x与y是否在同一团伙或者不确定他们在同一个团伙里 题目 The police office in Tadu City decides to say ends to the chaos, as launch actions to root up the TWO gangs in the city, Gang Dragon and Gang Snake. However, the police first needs to identify which gang a criminal belongs to. The present question is, given two criminals; do they belong to a same clan? You must give your judgment based on incomplete information. (Since the gangsters are always acting secretly.) Assume N (N 10^5) criminals are currently in Tadu City, numbered from 1 to N. And of course, at least one of them belongs to Gang Dragon, and the same for Gang Snake. You will be given M (M 10^5) messages in sequence, which are in the following two kinds: D [a] [b] where [a] and [b] are the numbers of two criminals, and they belong to different gangs. A [a] [b] where [a] and [b] are the numbers of two criminals. This requires you to decide whether a and b belong to a same gang. Input The first line of the input contains a single integer T (1 T 20), the number of test cases. Then T cases follow. Each test case begins with a line with two integers N and M, followed by M lines each containing one message as described above. Output For each message “A [a] [b]” in each case, your program should give the judgment based on the information got before. The answers might be one of “In the same gang.”, “In different gangs.” and “Not sure yet.” Sample Input 1 5 5 A 1 2 D 1 2 A 1 2 D 2 4 A 1 4 Sample Output Not sure yet. In different gangs. In the same gang. Sponsor 分析 这道题用的是种类并查集并查集把给出的人分成几个集合每个集合之间的人的关系不确定对同一个集合保存和本人不为同一队的人本着敌人的敌人便是朋友的原则用并查集同一集合为同一队不同集合为不同队。说的我自己都绕晕了23333 1.首先特殊解很重要当N2时他们属于不同的帮派因为题目有说两个帮派至少有一个人。 2. 1只要输入D就将a,b两个合并归在同一集合并将改他们的关系。 2输入A的时候判断a,b是否合并过如果两个不属于同一个集合的话就不能确定他们是否在同一个帮派。 3若合并过即前面已经出现过则有确定关系即是否在同一帮派。此时只要判定其dp【】值是否相同即为一个队为同一帮派否则不在。 原因我在把一个集合合并到另一个集合时把x根节点的dp变成和y根节点dp相对的每次连儿子保证和父亲不是一个帮派同时更新父亲然后在查找的时候要修改dp值注意回溯因为生成的树每一层和隔层的dp值是相对的0和1因为dp的值只能为0和1只有两个帮派所以类别偏移用位运算 4若我太啰嗦可参照 如下AC代码有步骤详解 #include stdio.h #define M 100010 int dp[M],f[M]; int i,n,m,a,b; int t; int find(int x) {int num;if(f[x]!x){numfind(f[x]);dp[x]dp[x]^dp[f[x]];//类别偏移可以用按位异或运算当两对应的二进位相异时结果为1。dp值是相对的0和1return f[x]num;}return x; } void dfs(int x,int y) {int ufind(x);int vfind(y);f[u]v;///dp[u]~(dp[y]^dp[x]);//类别偏移用按位取反运算即dp值是相对的0和1dp[u]1^dp[y]^dp[x]; /**更新x的父节点跟yy的父节点的关系,效果与按位取反相同.每次连儿子保证和父亲不是一个帮派同时更新父亲然后find时候注意回溯一下。*/ } int main() {scanf(%d,t);while(t--){scanf(%d%d,n,m);for(i0; in; i){dp[i]0;//0表示同派f[i]i;}for(i1; im; i){char s[5];scanf(%s%d%d,s,a,b);if(s[0]D)//只要输入D就将a,b两个合并并将改他们的关系dfs(a,b);else//,输入A的时候判断a,b是否合并过没有输出无法确定合并过再判断是不是同一派。{if(n2) //特殊解printf(In different gangs.\n);else if(find(a)find(b))///前面已经出现过则有确定关系即是否在同一帮派{if(dp[a]dp[b])printf(In the same gang.\n);elseprintf(In different gangs.\n);}elseprintf(Not sure yet.\n);}}}return 0; }
http://www.sadfv.cn/news/12635/

相关文章:

  • 旅行社做境外购物网站网站开发三个月能学会吗
  • 做网站的难点自贡做网站
  • 余杭区建设局网站舟山市普陀区建设局网站
  • 散文网站模板百度爱采购服务商查询
  • 社交网站wap模板陈欧做聚美优品网站
  • 阿里巴巴国际站做2个网站有用吗wordpress js放到oss
  • 更改备案网站名称wordpress主题会员付费
  • 上饶市建设局有什么网站网站建设维护费怎么说
  • 便宜的seo网站优化排名网站备案中国开头
  • 邢台移动网站建设服务网站描述怎么设置
  • 手机网站跳转怎么做关于建设网站群的报告
  • 珠宝玉器监测网站建设方案百度文档怎么免费下vvv
  • 万维网站建设个人简介网页制作模板代码
  • 嘉兴市做网站优化网址注册平台
  • 网站批量上传文章公司网站空间申请
  • 河南县网站建设公司仙桃哪里做网站
  • 无人在线观看高清完整视频下载seo入门培训学校
  • h5自适应网站模板服务器
  • 网站开发专利上海网站建设优
  • 做网站会用到什么语言营销型网站建设明细报
  • 淮安那家公司做网站网站描述如何写利于优化
  • 分分作网站备案查询网
  • 虚拟网站免费注册网站怎么推广比较好
  • 漯河网站推广公司安卓开发网站开发
  • 青岛建设网站的公司网站系统建设费用
  • 做建材的网站最好的网站建设用途
  • 网站如何添加js代码宁波外贸行业现状
  • 西宁建设网站软件学软件开发学费多少钱
  • 邯山区建设局网站邢台当地网站建设
  • 如何制作企业的网站网站规划设计的步骤