Submission #1067860

#TimeUsernameProblemLanguageResultExecution timeMemory
1067860LittleOrangeArranging Shoes (IOI19_shoes)C++17
Compilation error
0 ms0 KiB
#include "shoes.h" #include<bits/stdc++.h> using namespace std; using ll = long long; long long count_swaps(std::vector<int> s) { ll n = s.size()/2; ll ans = n*n*10; vector<ll> p(n*2); iota(p.begin(),p.end(),0); do{ ll ok = 1; for(ll i = 0;i<n;i++){ if (s[p[i*2]]>0||s[p[i*2+1]]<0||s[p[i*2]]+s[p[i*2+1]]!=0) { ok = 0; break; } } if(ok){ ll cur = 0; for(ll i = 0;i<n*2&&cur<ans;;i++) for(ll j = i+1;j<n*2&&cur<ans;j++){ cur += p[i]>p[j]; } ans = min(ans,cur); } }while(next_permutation(p.begin(),p.end())); return ans; }

Compilation message (stderr)

shoes.cpp: In function 'long long int count_swaps(std::vector<int>)':
shoes.cpp:20:32: error: expected primary-expression before ';' token
   20 |    for(ll i = 0;i<n*2&&cur<ans;;i++) for(ll j = i+1;j<n*2&&cur<ans;j++){
      |                                ^
shoes.cpp:20:32: error: expected ')' before ';' token
   20 |    for(ll i = 0;i<n*2&&cur<ans;;i++) for(ll j = i+1;j<n*2&&cur<ans;j++){
      |       ~                        ^
      |                                )
shoes.cpp:20:4: warning: this 'for' clause does not guard... [-Wmisleading-indentation]
   20 |    for(ll i = 0;i<n*2&&cur<ans;;i++) for(ll j = i+1;j<n*2&&cur<ans;j++){
      |    ^~~
shoes.cpp:20:33: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the 'for'
   20 |    for(ll i = 0;i<n*2&&cur<ans;;i++) for(ll j = i+1;j<n*2&&cur<ans;j++){
      |                                 ^
shoes.cpp:20:33: error: 'i' was not declared in this scope
shoes.cpp:20:53: error: 'j' was not declared in this scope
   20 |    for(ll i = 0;i<n*2&&cur<ans;;i++) for(ll j = i+1;j<n*2&&cur<ans;j++){
      |                                                     ^