Submission #235797

#TimeUsernameProblemLanguageResultExecution timeMemory
235797AASGArranging Shoes (IOI19_shoes)C++17
50 / 100
1094 ms1920 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]) && ((s[0]>0 && s[l]<0) || (s[0]<0 && s[l]>0))){ 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...