Cod sursa(job #3297434)
Utilizator | Data | 22 mai 2025 16:54:02 | |
---|---|---|---|
Problema | Hashuri | Scor | 100 |
Compilator | cpp-64 | Status | done |
Runda | Arhiva educationala | Marime | 0.48 kb |
#include <stdio.h>
#include <unordered_set>
int main() {
FILE *fin = fopen( "hashuri.in", "r" );
FILE *fout = fopen( "hashuri.out", "w" );
int q;
std::unordered_set<int> mata;
for( fscanf( fin, "%d", &q ); q--; ){
int task, x;
fscanf( fin, "%d%d", &task, &x );
if( task == 1 )
mata.insert( x );
else if( task == 2 )
mata.erase( x );
else
fprintf( fout, "%d\n", int(mata.count( x )) );
}
fclose( fin );
fclose( fout );
return 0;
}