My issue
Whats the difference in my code and others code, why am i getting tle
My code
#include<bits/stdc++.h>
using namespace std;
#define int long long
vector < int > a;
signed main() {
ios::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
int t;
cin >> t;
while (t--) {
int n;
cin >> n;
a.resize(n);
for (int i = 0; i < n; i++) {
cin >> a[i];
}
unordered_map < int, int > mp;
for (int i = 0; i < n; i++) {
for (int j = i + 1; j < n; j++) {
mp[a[i] ^ a[j]]++;
}
}
int ans = 0;
for (auto & v: mp) {
int k = v.second;
ans += (k * (k - 1));
}
cout << 4 LL * ans << "\n";
}
return 0;
}
Problem Link: Xometry (Easy Version) Practice Coding Problem