#include <iostream>
using namespace std;
template <typename T, typename U, int size1, int size2>
bool equal(T (&arr1)[size1], U (&arr2)[size2] ){
return false;
}
template <typename T, int size1, int size2>
bool equal(T (&arr1)[size1], T (&arr2)[size2] ){
if(size1 == size2) {
for(int i = 0 ; i < size1; ++i){
if(arr1[i] != arr2[i]) return false;
}
return true;
}
return false;
}
int main() {
int a1[]{1, 2, 3, 4};
int a2[]{1, 2, 3, 4};
int a3[]{1, 2, 3, 4, 5};
float a4[]{1, 2, 3, 4};
cout << "a1, a2 are "<< (equal(a1, a2) ? "same" : "different") <<endl ;
cout << "a1, a3 are "<< (equal(a1, a3) ? "same" : "different") <<endl ;
cout << "a1, a4 are "<< (equal(a1, a4) ? "same" : "different") <<endl ;
return 0;
}
I2luY2x1ZGUgPGlvc3RyZWFtPgp1c2luZyBuYW1lc3BhY2Ugc3RkOwoKdGVtcGxhdGUgPHR5cGVuYW1lIFQsIHR5cGVuYW1lIFUsIGludCBzaXplMSwgaW50IHNpemUyPgpib29sIGVxdWFsKFQgKCZhcnIxKVtzaXplMV0sIFUgKCZhcnIyKVtzaXplMl0gKXsKCXJldHVybiBmYWxzZTsKfQoKCnRlbXBsYXRlIDx0eXBlbmFtZSBULCBpbnQgc2l6ZTEsIGludCBzaXplMj4KYm9vbCBlcXVhbChUICgmYXJyMSlbc2l6ZTFdLCBUICgmYXJyMilbc2l6ZTJdICl7CglpZihzaXplMSA9PSBzaXplMikgewoJCWZvcihpbnQgaSA9IDAgOyBpIDwgc2l6ZTE7ICsraSl7CgkJCWlmKGFycjFbaV0gIT0gYXJyMltpXSkgcmV0dXJuIGZhbHNlOwoJCX0KCQlyZXR1cm4gdHJ1ZTsKCX0KCXJldHVybiBmYWxzZTsKfQoKaW50IG1haW4oKSB7CglpbnQgYTFbXXsxLCAyLCAzLCA0fTsKCWludCBhMltdezEsIDIsIDMsIDR9OwoJaW50IGEzW117MSwgMiwgMywgNCwgNX07CglmbG9hdCBhNFtdezEsIDIsIDMsIDR9OwoJY291dCA8PCAiYTEsIGEyIGFyZSAiPDwgKGVxdWFsKGExLCBhMikgPyAic2FtZSIgOiAiZGlmZmVyZW50IikgPDxlbmRsIDsKCWNvdXQgPDwgImExLCBhMyBhcmUgIjw8IChlcXVhbChhMSwgYTMpID8gInNhbWUiIDogImRpZmZlcmVudCIpIDw8ZW5kbCA7Cgljb3V0IDw8ICJhMSwgYTQgYXJlICI8PCAoZXF1YWwoYTEsIGE0KSA/ICJzYW1lIiA6ICJkaWZmZXJlbnQiKSA8PGVuZGwgOwoJCglyZXR1cm4gMDsKfQ==