Submission #888591

#TimeUsernameProblemLanguageResultExecution timeMemory
888591Lincito_31Arranging Shoes (IOI19_shoes)C++14
0 / 100
1 ms604 KiB
#include <bits/stdc++.h> #include "shoes.h" using namespace std; long long x=0; long long count_swaps(vector<int> s) { /*while(!s.empty()){ int i=0; while(s[i]>0){ i++; } x+=i; int abso=-s[i]; s.erase(s.begin()+i); i=0; while(s[i]!=abso){ i++; } x+=i; s.erase(s.begin()+i); } return x;*/ int num; if(s[0]<0){ num=-s[0]; }else{ num=s[0]; } while(s[0]==-num && s[1]==num){ s.erase(s.begin(),s.begin()+2); } int tam=s.size(); while(s[tam-2]==-num && s[tam-1]==num){ cout << "a"; s.erase(s.end()-2,s.end()); tam=s.size(); } while(!s.empty()){ int con=0; while(s[con]!=-num){ con++; } x+=con; s.erase(s.begin()+con); con=0; while(s[con]!=num){ con++; } x+=con; s.erase(s.begin()+con); } return x; }
#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...