Submission #302764

#TimeUsernameProblemLanguageResultExecution timeMemory
302764IWANTTOGETGOLDINIOIArranging Shoes (IOI19_shoes)C++14
Compilation error
0 ms0 KiB
#include "shoes.h" using namespace std; bool found[10004000404]; long long count_swaps(vector <int> s) { int n = s.size() / 2; int count_swaps = 0; for (int i = 0;i < s.size(); i++) { for (int j = s[i]; j < s.size();j++) { if (s[i] < 0) { if (-s[i] == s[j] && !found[-s[i]]) { count_swaps += (j - i); found[-s[i]] = true; } } else { if (s[i] == -s[j] && !found[s[i]]) { count_swaps += (j - i) + 1; found[s[i]] = true; } } } } return count_swaps; }

Compilation message (stderr)

shoes.cpp: In function 'long long int count_swaps(std::vector<int>)':
shoes.cpp:11:20: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   11 |   for (int i = 0;i < s.size(); i++)
      |                  ~~^~~~~~~~~~
shoes.cpp:13:28: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   13 |       for (int j = s[i]; j < s.size();j++)
      |                          ~~^~~~~~~~~~
shoes.cpp:9:7: warning: unused variable 'n' [-Wunused-variable]
    9 |   int n = s.size() / 2;
      |       ^
/usr/lib/gcc/x86_64-linux-gnu/9/libstdc++.a(vterminate.o): In function `__gnu_cxx::__verbose_terminate_handler()':
(.text._ZN9__gnu_cxx27__verbose_terminate_handlerEv+0x1a): relocation truncated to fit: R_X86_64_PC32 against `.bss._ZZN9__gnu_cxx27__verbose_terminate_handlerEvE11terminating'
/usr/lib/gcc/x86_64-linux-gnu/9/libstdc++.a(vterminate.o): In function `__gnu_cxx::__verbose_terminate_handler()':
(.text._ZN9__gnu_cxx27__verbose_terminate_handlerEv+0x27): relocation truncated to fit: R_X86_64_PC32 against `.bss._ZZN9__gnu_cxx27__verbose_terminate_handlerEvE11terminating'
/usr/lib/gcc/x86_64-linux-gnu/9/libstdc++.a(eh_alloc.o): In function `(anonymous namespace)::pool::free(void*) [clone .constprop.0]':
(.text._ZN12_GLOBAL__N_14pool4freeEPv.constprop.0+0x18): relocation truncated to fit: R_X86_64_PC32 against `.bss._ZN12_GLOBAL__N_114emergency_poolE'
/usr/lib/gcc/x86_64-linux-gnu/9/libstdc++.a(eh_alloc.o): In function `(anonymous namespace)::pool::free(void*) [clone .constprop.0]':
(.text._ZN12_GLOBAL__N_14pool4freeEPv.constprop.0+0x2c): relocation truncated to fit: R_X86_64_PC32 against `.bss._ZN12_GLOBAL__N_114emergency_poolE'
/usr/lib/gcc/x86_64-linux-gnu/9/libstdc++.a(eh_alloc.o): In function `(anonymous namespace)::pool::free(void*) [clone .constprop.0]':
(.text._ZN12_GLOBAL__N_14pool4freeEPv.constprop.0+0x53): relocation truncated to fit: R_X86_64_PC32 against `.bss._ZN12_GLOBAL__N_114emergency_poolE'
/usr/lib/gcc/x86_64-linux-gnu/9/libstdc++.a(eh_alloc.o): In function `(anonymous namespace)::pool::free(void*) [clone .constprop.0]':
(.text._ZN12_GLOBAL__N_14pool4freeEPv.constprop.0+0xb7): relocation truncated to fit: R_X86_64_PC32 against `.bss._ZN12_GLOBAL__N_114emergency_poolE'
/usr/lib/gcc/x86_64-linux-gnu/9/libstdc++.a(eh_alloc.o): In function `(anonymous namespace)::pool::free(void*) [clone .constprop.0]':
(.text._ZN12_GLOBAL__N_14pool4freeEPv.constprop.0+0xc3): relocation truncated to fit: R_X86_64_PC32 against `.bss._ZN12_GLOBAL__N_114emergency_poolE'
/usr/lib/gcc/x86_64-linux-gnu/9/libstdc++.a(eh_alloc.o): In function `(anonymous namespace)::pool::free(void*) [clone .constprop.0]':
(.text._ZN12_GLOBAL__N_14pool4freeEPv.constprop.0+0x116): relocation truncated to fit: R_X86_64_PC32 against `.bss._ZN12_GLOBAL__N_114emergency_poolE'
/usr/lib/gcc/x86_64-linux-gnu/9/libstdc++.a(eh_alloc.o): In function `(anonymous namespace)::pool::allocate(unsigned long) [clone .constprop.0]':
(.text._ZN12_GLOBAL__N_14pool8allocateEm.constprop.0+0x19): relocation truncated to fit: R_X86_64_PC32 against `.bss._ZN12_GLOBAL__N_114emergency_poolE'
/usr/lib/gcc/x86_64-linux-gnu/9/libstdc++.a(eh_alloc.o): In function `(anonymous namespace)::pool::allocate(unsigned long) [clone .constprop.0]':
(.text._ZN12_GLOBAL__N_14pool8allocateEm.constprop.0+0x3b): relocation truncated to fit: R_X86_64_PC32 against `.bss._ZN12_GLOBAL__N_114emergency_poolE'
/usr/lib/gcc/x86_64-linux-gnu/9/libstdc++.a(eh_alloc.o): In function `(anonymous namespace)::pool::allocate(unsigned long) [clone .constprop.0]':
(.text._ZN12_GLOBAL__N_14pool8allocateEm.constprop.0+0x53): additional relocation overflows omitted from the output
collect2: error: ld returned 1 exit status