编译错误
  • 板块灌水区
  • 楼主scj_juruo
  • 当前回复2
  • 已保存回复2
  • 发布时间2022/11/15 20:57
  • 上次更新2023/10/27 02:50:41
查看原帖
编译错误
805551
scj_juruo楼主2022/11/15 20:57

本地编译错误。

#include <bits/stdc++.h>
using namespace std;
int n;
unordered_map<string,pair<int,int>>m;
vector<pair<int,int>>v;
int main()
{
	ios::sync_with_stdio(0);
	m.clear();
	cin>>n;
	for(int i=1;i<=n;i++)
	{
		string cmd,f1,f2;
		cin>>cmd;
		if(cmd=="touch")
		{
			cin>>f1;
			if(m[f1].first==0)
			{
				m[f1].first=1;
				m[f1].second=i;
			}
		}
		else if(cmd=="rm")
		{
			cin>>f1;
			if(m[f1].first==1)
				m[f1].first=0;
		}
		else if(cmd=="rename")
		{
			cin>>f1>>f2;
			if(m[f1].first==1&&m[f2].first==0)
			{
				m[f1].second.first=0;
				m[f2].second.first=1;
				m[f2].second.second=i;
			}
		}
		else
		{
			for(unordered_map<string,pair<int,int>>::iterator it=m.begin();it!=m.end();it++)
				if(it->second.first==1)
					cout<<it->first<<endl;
		}
	}
	return 0;
}

说35,36,37行错误

2022/11/15 20:57
加载中...