Submission #145374

#TimeUsernameProblemLanguageResultExecution timeMemory
145374gmfabatArranging Shoes (IOI19_shoes)C++14
50 / 100
1078 ms3960 KiB
#include "shoes.h" #include <bits/stdc++.h> using namespace std; long long ans=0; vector<int> a; int swapp(int l,int r){ int t=a[r]; for (int i=r;i>l;i--) a[i]=a[i-1]; a[l]=t; } long long count_swaps(vector<int> s){ a=s; int n=s.size(); for (int i=0;i<n;i++) if (i%2==0){ int j ; for (j=i+1;;j++) if (a[i]+a[j]==0) break; if (a[i]<0){ swapp(i+1,j); ans+=j-i-1; }else{ swapp(i,j); ans+=j-i; } } return ans; }

Compilation message (stderr)

shoes.cpp: In function 'int swapp(int, int)':
shoes.cpp:13:1: warning: no return statement in function returning non-void [-Wreturn-type]
 }
 ^
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...