Submission #383778

#TimeUsernameProblemLanguageResultExecution timeMemory
383778meperdonas203Arranging Shoes (IOI19_shoes)C++17
10 / 100
30 ms2048 KiB
#include "shoes.h" #include<bits/stdc++.h> using namespace std; long long count_swaps(vector<int> s) { for(int i=0;i<s.size();i++){ s[i]=(s[i]<0)?-1:1; } int suma=0; int movs=0; for(auto i:s){ if(i<0){ if(suma>0){ movs+=suma; } suma+=i; }else{ suma+=i; if(suma<0){ movs+=abs(suma); } } } return movs; }

Compilation message (stderr)

shoes.cpp: In function 'long long int count_swaps(std::vector<int>)':
shoes.cpp:5:15: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
    5 |  for(int i=0;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...