Submission #235788

#TimeUsernameProblemLanguageResultExecution timeMemory
235788AASGArranging Shoes (IOI19_shoes)C++17
10 / 100
1085 ms1912 KiB
#include "shoes.h" #include <bits/stdc++.h> using namespace std; long long count_swaps(vector<int> s) { long long r=0; while(s.size()>0){ for(long l=1;l<s.size();l++){ if(abs(s[0])==abs(s[l])){ if(s[l]>0)r=r+l-1; else r=r+l; s.erase(s.begin()+l); s.erase(s.begin()); break; } } } return r; }

Compilation message (stderr)

shoes.cpp: In function 'long long int count_swaps(std::vector<int>)':
shoes.cpp:7:23: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
         for(long l=1;l<s.size();l++){
                      ~^~~~~~~~~
#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...