为什么TLE啊,复杂度貌似是对的
查看原帖
为什么TLE啊,复杂度貌似是对的
743373
Vitamin_B楼主2023/8/19 19:10
# include <bits/stdc++.h>

# define old_six \
	ios::sync_with_stdio (0);\
	\
	cin.tie (0);\
	\
	cout.tie (0);

# define ffor(i,name) \
	for (auto i = name.begin (); i != name.end (); ++ i)

# define reg register

using namespace std;

typedef long long ll;

typedef pair <int, int> pii;

typedef pair <ll, ll> pll;

int n, op, k, b, sum, maxx;

map <int, int> tot, x;

map <int, map <int, int>> mp;

int main () {

	old_six

	cin >> n;

	while (n --) {

		cin >> op >> k >> b;

		if (op < 2)
			++ tot[k], ++ sum, ++ mp[k][b];
		else if (op < 3)
			cout << sum - tot[k] << '\n';
		else
			x = mp[k], sum = tot[k] - mp[k][b], tot.clear (), mp.clear (), tot[k] = sum, mp[k] = x, mp[k][b] = 0;

	}

	return 0;

} 

TLE在最后一个点

2023/8/19 19:10
加载中...