一本通提交是格式错误 洛谷是 Wrong Answer.wrong answer On line 1 column 7, read(ASCII 13), expected .
#include<bits/stdc++.h>
using namespace std;
const int N=5e4+10;
string name[N];
map <string,int> nb;
int bcj[N],idx;
int find(int x)
{
if(bcj[x]==x)
return x;
return bcj[x]=find(bcj[x]);
}
int main()
{
// freopen("co","w",stdout);
for(int i=1;i<N;i++)
bcj[i]=i;
char t,t1;
string t2,t3,tt="-";
while((t=getchar())!='$')
{
if(t=='#')
{
getline(cin,t2);
if(nb[t2]==0)
{
name[++idx]=t2;
nb[t2]=idx;
}
}
else if(t=='+')
{
getline(cin,t3);
if(nb[t3]==0)
{
name[++idx]=t3;
nb[t3]=idx;
}
int xx=find(nb[t2]);
int yy=find(nb[t3]);
if(xx!=yy)
bcj[yy]=xx;
}
else
{
getline(cin,t3);
cout<<t3<<" "<<name[find(nb[t3])]<<'\n';
// if(tt!="-")
// cout<<tt<<'\n';
// tt=t3;
// tt+=" ";
// tt+=name[find(nb[t3])];
}
}
cout<<tt;
return 0;
}
求助!!