Submission #751335

#TimeUsernameProblemLanguageResultExecution timeMemory
751335kusmetliqArranging Shoes (IOI19_shoes)C++14
10 / 100
1084 ms3916 KiB
#include "shoes.h" #include<bits/stdc++.h> using namespace std; long long count_swaps(vector<int> s) { deque<int>a;for(int i:s)a.push_back(i); long long ans=0; while(a.size()>0) { int ind=-1; for(int i=0;i<a.size();i++) { if(a[i]<0) { ind=i; break; } } ans+=ind; int v=-a[ind]; a.erase(a.begin()+ind); int c=find(a.begin(),a.end(),v)-a.begin(); ans+=c; a.erase(a.begin()+c); } return ans; }

Compilation message (stderr)

shoes.cpp: In function 'long long int count_swaps(std::vector<int>)':
shoes.cpp:9:22: warning: comparison of integer expressions of different signedness: 'int' and 'std::deque<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
    9 |         for(int i=0;i<a.size();i++) {
      |                     ~^~~~~~~~~
#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...