#pragma once
class Set{
public:
std :: vector<int64_t> c;
Set( const std :: vector<int64_t>& other)
{
this->c = other;
}
void Add(int64_t value)
{
if(!this->Contains(value))
this->c.push_back(value);
}
void Remove(int64_t value)
{
int i;
for(i = 0; i < this->c.size(); i++)
{
if(this->c[i] == value) break;
}
int64_t c = this->c[i];
this->c[i] = this->c[this->c.size()-1];
this->c[this->c.size()-1] = c;
this->c.pop_back();
}
bool Contains(int64_t value) const
{
int i;
for(i = 0; i < this->c.size(); i++)
{
if(value == this->c[i]) return true;
}
return false;
}
Set Union(const Set& other) const
{
Set NewSet(this->c);
for(int i = 0; i < other.c.size(); i++)
{
NewSet.c.push_back(other.c[i]);
}
return NewSet;
}
Set Intersection(const Set& other) const
{
std :: vector<int64_t> NewVector;
for(int i = 0; i < this->c.size(); i++){
for(int j = 0; j < other.c.size(); j++)
if(this->c[i]==other.c[j]) NewVector.push_back(this->c[i]);
}
Set NewSet(NewVector);
return NewSet;
}
Set Difference(const Set& other) const
{
std :: vector<int64_t> NewVector;
for(int i = 0; i < this->c.size(); i++){
for(int j = 0; j < other.c.size(); j++)
if(this->c[i]!=other.c[j]) NewVector.push_back(this->c[i]);
}
Set NewSet(NewVector);
return NewSet;
}
Set SymmetricDifference(const Set& other) const
{
std :: vector<int64_t> NewVector;
for(int i = 0; i < this->c.size(); i++){
for(int j = 0; j < other.c.size(); j++)
if(this->c[i]!=other.c[j]) NewVector.push_back(this->c[i]);
}
for(int j = 0; j < other.c.size(); j++){
for(int i = 0; i < this->c.size(); i++)
if(other.c[j] != this->c[i]) NewVector.push_back(other.c[j]);
}
Set NewSet(NewVector);
return NewSet;
}
std :: vector<int64_t> Data() const
{
std :: vector<int64_t> NewVector;
NewVector = this->c;
return NewVector;
}
};