# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
348949 | ali_tavakoli | XOR Sum (info1cup17_xorsum) | C++14 | 1699 ms | 8940 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
//In The Name Of Allah
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define pb push_back
#define F first
#define S second
#pragma GCC optimize("Ofast")
const int maxn = 1e6 + 5;
int n, a[maxn], cnt[maxn];
void sub1()
{
ll ans = 0;
for(int i = 0; i < n; i++)
for(int j = i; j < n; j++)
ans ^= (a[i] + a[j]);
cout << ans << '\n';
}
void sub2()
{
ll ans = 0;
for(int i = 0; i < n; i++)
cnt[a[i]] ++;
for(int i = 0; i < maxn; i++)
for(int j = i; j < maxn; j++)
if((cnt[i] * cnt[j]) % 2)
ans ^= (i + j);
cout << ans << '\n';
}
int main()
{
ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
auto t = clock();
cin >> n;
for(int i = 0; i < n; i++)
cin >> a[i];
if(n <= (4e3))
sub1();
else
sub2();
}
컴파일 시 표준 에러 (stderr) 메시지
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |