Code
#include <iostream>
#include <vector>
using namespace std;
void solve() {
int n;
cin >> n;
vector<int> a(n);
for (int i = 0; i < n; ++i) cin >> a[i];
long long ans = 0;
vector<int> seen;
for (int i = n - 1; i >= 0; --i) {
int C = (i + 1) ^ a[i];
for (int val : seen) {
if (C < val) ++ans;
}
seen.push_back(C);
}
cout << ans << '\n';
}
int main() {
ios::sync_with_stdio(false);
cin.tie(0);
int t;
cin >> t;
while (t--) solve();
}
Information
- Submit By
- Type
- Pretest
- Problem
- P1198 E. Good Signal Pairs
- Language
- C++17 (G++ 13.2.0)
- Submit At
- 2025-06-13 17:50:54
- Judged At
- 2025-06-13 17:50:54
- Judged By
- Score
- 0
- Total Time
- 1ms
- Peak Memory
- 540.0 KiB