Submission #889069

#TimeUsernameProblemLanguageResultExecution timeMemory
889069Lincito_31Arranging Shoes (IOI19_shoes)C++14
10 / 100
1090 ms4372 KiB
#include <bits/stdc++.h> #include "shoes.h" using namespace std; long long x=0; long long count_swaps(vector<int> s) { string xd=""; int tam=s.size(); for(int i=0;i<tam;i++){ if(s[i]>0){ xd=xd+"+"; }else{ xd=xd+"-"; } } while(xd.find('+')!=-1){ int i=0; while(xd[i]!='-'){ i++; } x+=i; xd.replace(i,1,""); i=0; while(xd[i]!='+'){ i++; } x+=i; xd.replace(i,1,""); } return x; }

Compilation message (stderr)

shoes.cpp: In function 'long long int count_swaps(std::vector<int>)':
shoes.cpp:15:20: warning: comparison of integer expressions of different signedness: 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   15 |  while(xd.find('+')!=-1){
      |        ~~~~~~~~~~~~^~~~
#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...