求助一道题,进来帮帮我呀
  • 板块学术版
  • 楼主i_am_a_joker
  • 当前回复4
  • 已保存回复4
  • 发布时间2020/10/5 21:35
  • 上次更新2023/11/5 11:53:01
查看原帖
求助一道题,进来帮帮我呀
245089
i_am_a_joker楼主2020/10/5 21:35

这不是洛谷题库的一道题,我把题目直接用图片粘过来

#include<iostream>
#include<map>
using namespace std;
int n,t;
map<long long,pair<string,int> > mp;
int main()
{
	cin>>t;
	while(t--)
	{
		cin>>n;
		if(n == 1)
		{
			long long xh;
			string na;
			int br;
			cin>>xh>>na>>br;
			if(mp[xh].second != ' ')
			{
				mp[br].second = br;
				mp[xh].first = na;
			}
			mp[xh].second --;
		}
		if(n == 2)
		{
			long long xh;
			cin>>xh;
			if(mp[xh].first != " ")
			{
				mp[xh].first = " ";
			}
			mp[xh].second --;
		}
		if(n == 3)
		{
			long long xh;
			cin>>xh;
			if(mp[xh].first != " ")
			{
				cout<<"yes"<<endl;
			}else
			{
				cout<<"no"<<endl;
			}
		}
		if(n == 4)
		{
			int br;
			cin>>br;
			if(mp[br].second != ' ')
			{
				cout<<mp[br].second<<endl;
			}
		}
	}
	return 0;
}

这是我的代码,输出

yes
no
-1
1
1

请问哪里有问题呢?求助

2020/10/5 21:35
加载中...