性♂感♂双♂map♂代♂码♂求♂调♂教
查看原帖
性♂感♂双♂map♂代♂码♂求♂调♂教
553274
Iakioieverycentury楼主2025/2/7 16:43
#include<iostream>
#include<cstring>
#include<map>
#define int long long
using namespace std;
map<pair<int,int>,int> t;
map<int,int> nok;
//nok 是 number of k
int count;
int n;
int opt,k,b;
int cnt;
inline int read(){
	int x=0,f=1;
	char ch=getchar();
	while(!isdigit(ch)){
		if(ch=='-')f=-1;
		ch=getchar();
	}
	while(isdigit(ch)){
		x=(x<<1)+(x<<3)+(ch^48);
		ch=getchar(); 
	}
	return x*f;
}
inline void write(int x){
	if(x<0)putchar('-'),x=-x;
	if(x>9)write(x/10);
	putchar(x%10+48);
}
signed main(){
	n=read();
	for(int i=1;i<=n;i++){
		opt=read(),k=read(),b=read();
		if(opt==1){
			t[make_pair(k,b)]++;
			count++;
			nok[k]++;
		}
		if(opt==2){
			write(count-nok[k]);
			puts("");
		}
		if(opt==3){
			count=nok[k];
			nok.clear();
			nok[k]=count;
			count-=t[make_pair(k,b)];
		}
	}
	return 0;
}
2025/2/7 16:43
加载中...