Submission #319097

# Submission time Handle Problem Language Result Execution time Memory
319097 2020-11-04T00:19:26 Z mohamedsobhi777 XOR Sum (info1cup17_xorsum) C++14
0 / 100
1576 ms 2284 KB
#include <bits/stdc++.h>

#pragma GCC optimize("-Ofast")
//#pragma GCC optimize("trapv")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,sse4.2,popcnt,abm,mmx,avx2,tune=native")
#pragma GCC optimize("-ffast-math")
#pragma GCC optimize("-funroll-loops")

#define I inline void
#define S struct
#define vi vector<int>
#define vii vector<pair<int, int>>
#define pii pair<int, int>
#define pll pair<ll, ll>

using namespace std;
using ll = long long;
using ld = long double;

const int N = 2e5 + 7, mod = 1e9 + 7;
const ll inf = 2e18;

// How interesting!

int n;
int a[N];
ll ans;

int main()
{
        ios_base::sync_with_stdio(0);
        cin.tie(0);
        //freopen("in.in", "r", stdin);

        cin >> n;
        for (int i = 0; i < n; ++i)
                cin >> a[i];

        for (int r = 0; r < 25; ++r)
        {
                int R = (1 << r) * 2;
                for (int i = 0; i < n; ++i)
                {
                        for (int j = 0; j <= i; ++j)
                        {
                                if ((a[i] + a[j]) % R >= (1 << r))
                                {
                                        ans ^= (1 << r);
                                }
                        }
                }
        }

        cout << ans;
        return 0;
}

/*
        - bounds sir (segtree = 4N, eulerTour = 2N, ...)
        - a variable defined twice?
        - will overflow?
        - is it a good complexity?
        - don't mess up indices (0-indexed vs 1-indexed)
        - reset everything between testcases. 
*/
# Verdict Execution time Memory Grader output
1 Incorrect 1576 ms 484 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 26 ms 2284 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 26 ms 2284 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1576 ms 484 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1576 ms 484 KB Output isn't correct
2 Halted 0 ms 0 KB -