请佬们看看有什么问题,只过了第一个
查看原帖
请佬们看看有什么问题,只过了第一个
1189413
PURE_LOVE楼主2024/5/6 23:23
#include<bits/stdc++.h>
using namespace std;
struct beibao
{
	int i;
	int j;
	beibao() {
		i = 0; j = 0;
	}
	explicit beibao(int x, int y) : i(x), j(y) {}
	bool operator<(const beibao& other) const {
		if (other.i < i) {
			return true;
		}
		return false;
	}
};
int main()
{
	int n = 0, t = 0;
	cin >> n >> t;
	map<beibao, int>arr;
	while (t--)
	{
		int a = 0, b = 0, c = 0, d = 0;
		scanf("%d%d%d", &a, &b, &c);
		beibao temp;
		temp.i = b;
		temp.j = c;
		if (a == 1)
		{
			scanf("%d", &d);
			auto it = arr.find(temp);
			if (it == arr.end())
			{
				arr[temp] = d;
			}
			else
			{
				it->second = d;
			}
		}
		if (a == 2)
		{
			auto it =arr.find(temp);
			printf("%d\n", it->second);
		}
	}
}
2024/5/6 23:23
加载中...