답안 #649365

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
649365 2022-10-10T06:14:58 Z azra_gonul XOR Sum (info1cup17_xorsum) C++14
7 / 100
1600 ms 7276 KB
#include<bits/stdc++.h>
using namespace std;
int main(){
	long long a,b,c,d;
	vector <long long> herk;
	map <long long ,long long> mp;
	map <long long ,long long> xomp;
	c=0;
	cin>>a;
	for(long long i=0;a>i;i++){
		cin>>b;
		if(mp[b]){
			mp[b]++;
		}
		else{
			mp[b]++;
			herk.push_back(b);
		}
	}
	for(long long i=0;herk.size()>i;i++){
		if(mp[herk[i]] % 2 == 0){
			c^=herk[i]*2;
		}
		
	}
	for(long long i=0;herk.size()>i;i++){
		if(mp[herk[i]] % 2 == 1){
		for(long long k=i;herk.size()>k;k++){
			if(mp[herk[k]] % 2 == 1){c^=(herk[k]+herk[i]);}
		}
	}
	}
		cout<<c;
}

Compilation message

xorsum.cpp: In function 'int main()':
xorsum.cpp:20:31: warning: comparison of integer expressions of different signedness: 'std::vector<long long int>::size_type' {aka 'long unsigned int'} and 'long long int' [-Wsign-compare]
   20 |  for(long long i=0;herk.size()>i;i++){
      |                    ~~~~~~~~~~~^~
xorsum.cpp:26:31: warning: comparison of integer expressions of different signedness: 'std::vector<long long int>::size_type' {aka 'long unsigned int'} and 'long long int' [-Wsign-compare]
   26 |  for(long long i=0;herk.size()>i;i++){
      |                    ~~~~~~~~~~~^~
xorsum.cpp:28:32: warning: comparison of integer expressions of different signedness: 'std::vector<long long int>::size_type' {aka 'long unsigned int'} and 'long long int' [-Wsign-compare]
   28 |   for(long long k=i;herk.size()>k;k++){
      |                     ~~~~~~~~~~~^~
xorsum.cpp:4:18: warning: unused variable 'd' [-Wunused-variable]
    4 |  long long a,b,c,d;
      |                  ^
# 결과 실행 시간 메모리 Grader output
1 Correct 668 ms 560 KB Output is correct
2 Correct 637 ms 556 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Incorrect 686 ms 576 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 686 ms 576 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 668 ms 560 KB Output is correct
2 Correct 637 ms 556 KB Output is correct
3 Execution timed out 1684 ms 7276 KB Time limit exceeded
4 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 668 ms 560 KB Output is correct
2 Correct 637 ms 556 KB Output is correct
3 Incorrect 686 ms 576 KB Output isn't correct
4 Halted 0 ms 0 KB -