Submission #332361

#TimeUsernameProblemLanguageResultExecution timeMemory
332361nicholaskArranging Shoes (IOI19_shoes)C++14
50 / 100
1092 ms2156 KiB
#include "shoes.h" #include <bits/stdc++.h> using namespace std; long long count_swaps(vector <int> s){ int n=(s.size()>>1); if (n<=1000){ long long ans=0; for (int i=0; i<n+n; i+=2){ int wh; for (int j=1; ; j++){ if (s[0]*-1==s[j]){ wh=j; break; } } if (s[0]>0) ans++; ans+=wh-1; s.erase(s.begin()+wh); s.erase(s.begin()); } return ans; } } /* signed main(){ int n; cin>>n; vector <int> v(n); for (int i=0; i<n; i++) cin>>v[i]; cout<<count_swaps(v); } */

Compilation message (stderr)

shoes.cpp: In function 'long long int count_swaps(std::vector<int>)':
shoes.cpp:23:1: warning: control reaches end of non-void function [-Wreturn-type]
   23 | }
      | ^
#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...