Submission #1315876

#TimeUsernameProblemLanguageResultExecution timeMemory
1315876raqin_shahrierArranging Shoes (IOI19_shoes)C++20
Compilation error
0 ms0 KiB
#include<bits/stdc++.h> using namespace std; 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:5:27: error: expected ',' or '...' before 'S'
    5 | int32_t count_swaps(int[] S){
      |                           ^
shoes.cpp: In function 'int32_t count_swaps(int*)':
shoes.cpp:6:13: error: 'S' was not declared in this scope
    6 |     int n = S.size()/2;
      |             ^