Submission #1315874

#TimeUsernameProblemLanguageResultExecution timeMemory
1315874raqin_shahrierArranging Shoes (IOI19_shoes)C++20
Compilation error
0 ms0 KiB
int64 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: 'int64' does not name a type; did you mean 'int'?
    1 | int64 count_swaps(int[] S){
      | ^~~~~
      | int