Submission #269884

# Submission time Handle Problem Language Result Execution time Memory
269884 2020-08-17T11:01:37 Z AKaan37 XOR Sum (info1cup17_xorsum) C++17
18 / 100
167 ms 4216 KB
//Bismillahirrahmanirrahim
//█▀█─█──█──█▀█─█─█
//█▄█─█──█──█▄█─█▄█
//█─█─█▄─█▄─█─█─█─█

#include <bits/stdc++.h>

using namespace std;

typedef long long lo;
typedef pair< lo,lo > PII;

#define fi first
#define se second
#define mp make_pair
#define endl "\n"
#define pb push_back
#define fio() ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#define FOR for(int i=1;i<=n;i++)
#define mid ((start+end)/2)
#define ort ((bas+son)/2)

const lo inf = 1000000000000000000;
const lo KOK = 100000;
const lo LOG = 30;
const lo li = 500005;
const lo mod = 1000000007;

int n,m,b[li],a[li],k,flag,t,mpp[4005];
int cev;
string s;
vector<int> v;

int main(void){
	scanf("%d",&n);
	FOR{
		scanf("%d",&a[i]);
	}
	if(n<=10000){
		FOR{
			for(int j=i;j<=n;j++){
				cev=cev^(a[j]+a[i]);
			}
		}
	}
	else{
		FOR{
			mpp[a[i]]++;
		}
		for(int i=1;i<=4000;i++){
			if((mpp[i]*(mpp[i]+1)/2)%2)cev=cev^(i*2);
			if(mpp[i]%2==0)continue;
			for(int j=i+1;j<=4000;j++){
				if(mpp[j]%2==0)continue;
				cev=cev^(j+i);
			}
		}
	}
	printf("%d\n",cev);
	return 0;
}

Compilation message

xorsum.cpp: In function 'int main()':
xorsum.cpp:35:7: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   35 |  scanf("%d",&n);
      |  ~~~~~^~~~~~~~~
xorsum.cpp:37:8: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   37 |   scanf("%d",&a[i]);
      |   ~~~~~^~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 6 ms 384 KB Output is correct
2 Correct 6 ms 384 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 134 ms 4216 KB Output is correct
2 Correct 131 ms 3960 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 134 ms 4216 KB Output is correct
2 Correct 131 ms 3960 KB Output is correct
3 Incorrect 167 ms 4216 KB Output isn't correct
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 6 ms 384 KB Output is correct
2 Correct 6 ms 384 KB Output is correct
3 Runtime error 24 ms 1280 KB Execution killed with signal 11
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 6 ms 384 KB Output is correct
2 Correct 6 ms 384 KB Output is correct
3 Correct 134 ms 4216 KB Output is correct
4 Correct 131 ms 3960 KB Output is correct
5 Incorrect 167 ms 4216 KB Output isn't correct
6 Halted 0 ms 0 KB -