Cod sursa(job #1220499)

Utilizator ptquake10ptquake10 ptquake10 Data 17 august 2014 15:21:57
Problema Hashuri Scor 70
Compilator cpp Status done
Runda Arhiva educationala Marime 0.61 kb
#include <iostream>
#include <cstdio>
#include <vector>
#include <stack>
#include <queue>
#include <algorithm>
#include <cmath>
#include <cstring>
#include <fstream>
#include <map>
using namespace std;

int n;
map<int,int> m[10];

int main() {
	int op, x;
	
	freopen("hashuri.in","r",stdin);
	freopen("hashuri.out","w",stdout);
	scanf("%d", &n);
	for (int i = 1; i <= n; i++) {
		scanf("%d %d", &op, &x);
		switch(op) {
			case 1:
				m[x%10][x]++;
				break;
			case 2:
				m[x%10][x]--;
				break;
			case 3:
				if (m[x%10][x] > 0) printf("1\n"); else printf("0\n");
		}
	}
	
	return 0;
}