Time Exceeded
Code
#include<bits/stdc++.h>
#define endl '\n'
using namespace std;
using ll = long long;
void bruteForce() {
int n;
cin >> n;
vector<int> v(n);
for(auto &i: v) cin >> i;
ll ans = 0;
for (int i = 1; i <= n; i++) {
for(int j = i + 1; j <= n; j++) {
if((v[i - 1] ^ i) < ((v[j - 1] ^ i) ^ j)) ++ans;
}
}
cout << ans << endl;
return;
}
int main() {
ios::sync_with_stdio(false); cin.tie(0);
int tc = 1;
cin >> tc;
for (int t = 1; t <= tc; t++) {
// cout << "Case " << t << ": ";
bruteForce();
}
return 0;
}
Information
- Submit By
- Type
- Submission
- Problem
- P1198 E. Good Signal Pairs
- Language
- C++17 (G++ 13.2.0)
- Submit At
- 2025-05-22 11:19:33
- Judged At
- 2025-05-22 11:19:33
- Judged By
- Score
- 12
- Total Time
- ≥2100ms
- Peak Memory
- ≥1.789 MiB