#include <iostream>
#include <vector>
#include <map>
#include <cstdint>
typedef std::vector<std::uint64_t> LType;
typedef std::map<std::uint64_t, std::uint64_t> MType;
bool MakeHoge(LType& A, LType& B){
MType M;
std::uint64_t N = 0;
for (auto& o : A){
M[o]++;
}
for (auto& o : B){
if (M[o] != 0){
N++;
M[o]--;
}
}
return N == 2;
}
bool Show(LType& A, LType& B, bool R){
std::cout <<'[';
for (auto& o : A){
std::cout << o << ' ';
}
std::cout <<']';
std::cout <<'[';
for (auto& o : B){
std::cout << o << ' ';
}
std::cout <<']'<<' '<<"->"<<' ';
std::cout << (R? "真" : "偽") << std::endl;
return true;
}
int main(){
LType A, B;
bool R;
A = { 1, 2, 3 };
B = { 1, 2, 3 };
R = MakeHoge(A, B);
Show(A, B, R);
A = { 1, 2, 3 };
B = { 5, 6, 7 };
R = MakeHoge(A, B);
Show(A, B, R);
A = { 1, 1, 1 };
B = { 1, 1, 2 };
R = MakeHoge(A, B);
Show(A, B, R);
A = { 1, 1, 2, };
B = { 2, 2, 1 };
R = MakeHoge(A, B);
Show(A, B, R);
A = { 9, 8, 9 };
B = { 8, 6, 4 };
R = MakeHoge(A, B);
Show(A, B, R);
A = { 9, 7, 2 };
B = { 2, 2, 9 };
R = MakeHoge(A, B);
Show(A, B, R);
return 0;
}
/** /
[1, 2, 3], [1, 2, 3]->偽
[1, 2, 3], [5, 6, 7]->偽
[1, 1, 1], [1, 1, 2]->真
[1, 1, 2], [2, 2, 1]->真
[9, 8, 9], [8, 6, 4]->偽
[9, 7, 2], [2, 2, 9]->真
/**/
I2luY2x1ZGUgPGlvc3RyZWFtPgojaW5jbHVkZSA8dmVjdG9yPgojaW5jbHVkZSA8bWFwPgojaW5jbHVkZSA8Y3N0ZGludD4KCnR5cGVkZWYgc3RkOjp2ZWN0b3I8c3RkOjp1aW50NjRfdD4gTFR5cGU7CnR5cGVkZWYgc3RkOjptYXA8c3RkOjp1aW50NjRfdCwgc3RkOjp1aW50NjRfdD4gTVR5cGU7Cgpib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