Submission #1315875

#TimeUsernameProblemLanguageResultExecution timeMemory
1315875raqin_shahrierArranging Shoes (IOI19_shoes)C++20
Compilation error
0 ms0 KiB
int32_t count_swaps(int[] S){ int n = S.size()/2; vector<int>s(2*n); for(int i = 0; i<2*n; i++){ cin>>s[i]; } int ans = 0; for(int i = 0; i<2*n; i+=2){ int x = -s[i]; for(int j = i+1; j<2*n; j++){ if(s[j] == x){ for(int k = j; k>i+1; k--){ swap(s[k],s[k-1]); ans++; } if(s[i] > 0){ swap(s[i], s[i+1]); ans++; } break; } } } return ans; }

Compilation message (stderr)

shoes.cpp:1:1: error: 'int32_t' does not name a type
    1 | int32_t count_swaps(int[] S){
      | ^~~~~~~
shoes.cpp:1:1: note: 'int32_t' is defined in header '<cstdint>'; did you forget to '#include <cstdint>'?
  +++ |+#include <cstdint>
    1 | int32_t count_swaps(int[] S){