Submission #532199

#TimeUsernameProblemLanguageResultExecution timeMemory
532199andecaandeciArranging Shoes (IOI19_shoes)C++17
Compilation error
0 ms0 KiB
#include <bits/stdc++.h> using namespace std; long long count_swaps(vector<int> s){ int n = s.size(); long long ans = 0; for(int i=0;i<n;i+=2){ int j; for(j = i+1;abs(s[j]) !+ abs(s[i]) || s[i] * s[j] > 0;++j){ if(s[j] != 0){ ans ++; } } for(int k = j;k > i + 1;k--){ swap(s[k],s[k-1]); } if(s[i] > 0) ans++; } return ans; }

Compilation message (stderr)

shoes.cpp: In function 'long long int count_swaps(std::vector<int>)':
shoes.cpp:10:30: error: expected ';' before '!' token
   10 |         for(j = i+1;abs(s[j]) !+ abs(s[i]) || s[i] * s[j] > 0;++j){
      |                              ^~
      |                              ;
shoes.cpp:10:62: error: expected ')' before ';' token
   10 |         for(j = i+1;abs(s[j]) !+ abs(s[i]) || s[i] * s[j] > 0;++j){
      |            ~                                                 ^
      |                                                              )
shoes.cpp:10:9: warning: this 'for' clause does not guard... [-Wmisleading-indentation]
   10 |         for(j = i+1;abs(s[j]) !+ abs(s[i]) || s[i] * s[j] > 0;++j){
      |         ^~~
shoes.cpp:10:63: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the 'for'
   10 |         for(j = i+1;abs(s[j]) !+ abs(s[i]) || s[i] * s[j] > 0;++j){
      |                                                               ^~
shoes.cpp:10:66: error: expected ';' before ')' token
   10 |         for(j = i+1;abs(s[j]) !+ abs(s[i]) || s[i] * s[j] > 0;++j){
      |                                                                  ^
      |                                                                  ;