/ SeriousOJ /

Record Detail

Wrong Answer


  
# Status Time Cost Memory Cost
#1 Accepted 1ms 540.0 KiB
#2 Wrong Answer 1ms 540.0 KiB
#3 Wrong Answer 1ms 584.0 KiB

Code

#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
using namespace std;

template <typename T>
using o_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;

int main()
{
    ios::sync_with_stdio(false);
    cin.tie(nullptr);

    int t;
    cin >> t;
    while (t--)
    {
        int n;
        cin >> n;
        long long ans = 0;
        o_set<pair<int, int>> st;

        for (int i = 1; i <= n; ++i)
        {
            int x;
            cin >> x;
            int d = (i ^ x);
            ans +=  st.order_of_key({d, INT_MAX});
            st.insert({d, i});
        }
        cout << ans << '\n';
    }
    return 0;
}

Information

Submit By
Type
Submission
Problem
P1198 E. Good Signal Pairs
Contest
Brain Booster #10
Language
C++17 (G++ 13.2.0)
Submit At
2025-06-13 16:18:55
Judged At
2025-06-13 16:18:55
Judged By
Score
1
Total Time
1ms
Peak Memory
584.0 KiB