Submission #644669

# Submission time Handle Problem Language Result Execution time Memory
644669 2022-09-25T06:07:13 Z notme XOR Sum (info1cup17_xorsum) C++14
0 / 100
99 ms 12736 KB
#include<bits/stdc++.h>
#define endl '\n'
using namespace std;
const int MAXN = 1e6 + 10;
void speed()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
}

int n;
long long a[MAXN];
long long cnt[MAXN];
long long maxx = 0;
void read()
{
    cin >> n;
    for (int i = 1; i <= n; ++ i)
    {
        cin >> a[i];
        cnt[a[i]] ++;
        maxx = max(maxx, a[i]);
    }
}

void solve1()
{
    long long ans = 0;
    for (int i = 1; i <= n; ++ i)
    {
        for (int j = 1; j <= n; ++ j)
        {
            ans = (ans ^ (a[i] + a[j]));
        }
    }
    cout << ans << endl;
}

void solve2()
{
    int ans = 0;
    for (int i = 1; i <= 4*1e3; ++ i)
    {
        for (int j = 1; j <= 4*1e3; ++ j)
        {
            int times = cnt[i] * cnt[j];
            int used = times / 2 + times % 2;
            if(used & 1)ans = (ans ^ (i + j));
        }
    }
    cout << ans << endl;
}
int main()
{
    speed();

    read();
    if(n <= 4 * 1e3)solve1();
    else if(maxx <= 4 * 1e3)solve2();
    return 0;
}
# Verdict Execution time Memory Grader output
1 Runtime error 1 ms 516 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 99 ms 12736 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 99 ms 12736 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 1 ms 516 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 1 ms 516 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -