首页 > TAG信息列表 > P2256

P2256 一中校运会之百米跑

传送门 思路: 变种后的并查集,用map<string,string>来存。 #include<bits/stdc++.h> using namespace std; const int mod = 1e9 + 7; const int inf = 0x3f3f3f3f; #define ll long long map<string,string>f; string find(string x) { if(f[x] != x) return f[x]

P2256 一中校运会之百米跑

题目背景 在一大堆秀恩爱的**之中,来不及秀恩爱的苏大学神踏着坚定(?)的步伐走向了100米跑的起点。这时苏大学神发现,百米赛跑的参赛同学实在是太多了,连体育老师也忙不过来。这时体育老师发现了身为体育委员的苏大学神,便来找他帮忙。可是苏大学神需要热身,不然跑到一半就会抽(筋)、于是他

P2256 一中校运会之百米跑

算法 并查集+map 思路 板子改为字符串 代码 #include<iostream> #include<cstdio> #include<map>//map库 using namespace std; map<string,string> a;//建立映射 string fin(string x){//查找字符串x的祖先 if(a[x]==x) return x; else return a[x]=fin(a[x]);//路径压