Submission #889084

#TimeUsernameProblemLanguageResultExecution timeMemory
889084Lincito_31Arranging Shoes (IOI19_shoes)C++14
50 / 100
1095 ms1996 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 temp=s[0]; if(temp<0){ for(int i=1;i<s.size();i++){ if(s[i]==-temp){ x+=i-1; s.erase(s.begin()+i); break; } } s.erase(s.begin()); }else{ for(int i=1;i<s.size();i++){ if(s[i]==-temp){ x+=i; s.erase(s.begin()+i); break; } } s.erase(s.begin()); } } return x; }

Compilation message (stderr)

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