답안 #649367

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
649367 2022-10-10T06:28:26 Z birisi XOR Sum (info1cup17_xorsum) C++14
컴파일 오류
0 ms 0 KB
#include <bits/stdc++.h>
using namespace std;

int say[600000000];

int main() {

	int n;
	cin >> n;

	vector <int> v;

	int x;
	for (int i = 0; i < n; i++) {
		cin >> x;
		if (say[x] == 0)
			v.push_back(x);
		say[x]++;
	}

	int an = 0;
	vector <int> d;
	for (int i = 0; i < v.size(); i++) {
		x = v[i];
		if (say[x]%2 == 1){
			d.push_back(x);
		}
		if (say[x]%4 == 2)
			an = an^(2*x);
	}

	for (int i = 0; i < d.size(); i++) {
		for (int j = i; j < d.size(); j++) {
			an = an ^ (d[i] + d[j]);
		}
	}

	cout << an;

}

Compilation message

xorsum.cpp: In function 'int main()':
xorsum.cpp:23:20: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   23 |  for (int i = 0; i < v.size(); i++) {
      |                  ~~^~~~~~~~~~
xorsum.cpp:32:20: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   32 |  for (int i = 0; i < d.size(); i++) {
      |                  ~~^~~~~~~~~~
xorsum.cpp:33:21: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   33 |   for (int j = i; j < d.size(); j++) {
      |                   ~~^~~~~~~~~~
/tmp/ccZQ4FYH.o: in function `main':
xorsum.cpp:(.text.startup+0x9): relocation truncated to fit: R_X86_64_PC32 against symbol `std::cin' defined in .bss._ZSt3cin section in /usr/lib/gcc/x86_64-linux-gnu/10/libstdc++.a(globals_io.o)
xorsum.cpp:(.text.startup+0x86): relocation truncated to fit: R_X86_64_PC32 against symbol `std::cin' defined in .bss._ZSt3cin section in /usr/lib/gcc/x86_64-linux-gnu/10/libstdc++.a(globals_io.o)
xorsum.cpp:(.text.startup+0x1e1): relocation truncated to fit: R_X86_64_PC32 against symbol `std::cout' defined in .bss._ZSt4cout section in /usr/lib/gcc/x86_64-linux-gnu/10/libstdc++.a(globals_io.o)
/tmp/ccZQ4FYH.o: in function `_GLOBAL__sub_I_say':
xorsum.cpp:(.text.startup+0x28b): relocation truncated to fit: R_X86_64_PC32 against `.bss'
xorsum.cpp:(.text.startup+0x2a9): relocation truncated to fit: R_X86_64_PC32 against `.bss'
/usr/lib/gcc/x86_64-linux-gnu/10/libstdc++.a(vterminate.o): in function `__gnu_cxx::__verbose_terminate_handler()':
(.text._ZN9__gnu_cxx27__verbose_terminate_handlerEv+0x1e): relocation truncated to fit: R_X86_64_PC32 against `.bss._ZZN9__gnu_cxx27__verbose_terminate_handlerEvE11terminating'
(.text._ZN9__gnu_cxx27__verbose_terminate_handlerEv+0x2b): relocation truncated to fit: R_X86_64_PC32 against `.bss._ZZN9__gnu_cxx27__verbose_terminate_handlerEvE11terminating'
/usr/bin/ld: failed to convert GOTPCREL relocation; relink with --no-relax
collect2: error: ld returned 1 exit status