Submission #889450

#TimeUsernameProblemLanguageResultExecution timeMemory
889450Lincito_31Arranging Shoes (IOI19_shoes)C++14
10 / 100
1063 ms3164 KiB
#include <bits/stdc++.h> #include "shoes.h" using namespace std; long long x=0; long long count_swaps(vector<int> s) { int indi_po=0; int indi_ne=0; while(!s.empty()){ int temp=s[0]; if(temp<0){ for(;indi_po<s.size();indi_po++){ if(s[indi_po]==-temp){ x+=indi_po-1; s.erase(s.begin()+indi_po); break; } } indi_po--; s.erase(s.begin()); }else{ for(;indi_ne<s.size();indi_ne++){ if(s[indi_ne]==-temp){ x+=indi_ne; s.erase(s.begin()+indi_ne); break; } } indi_ne--; s.erase(s.begin()); } } return x; }

Compilation message (stderr)

shoes.cpp: In function 'long long int count_swaps(std::vector<int>)':
shoes.cpp:11:25: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   11 |             for(;indi_po<s.size();indi_po++){
      |                  ~~~~~~~^~~~~~~~~
shoes.cpp:21:25: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   21 |             for(;indi_ne<s.size();indi_ne++){
      |                  ~~~~~~~^~~~~~~~~
#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...