Submission #889458

#TimeUsernameProblemLanguageResultExecution timeMemory
889458Lincito_31Arranging Shoes (IOI19_shoes)C++14
45 / 100
26 ms4056 KiB
#include <bits/stdc++.h> #include "shoes.h" using namespace std; long long x=0; long long count_swaps(vector<int> s) { vector<int> xd_po; vector<int> xd_ne; for(int i=0;i<s.size();i++){ if(s[i]<0){ if(i%2!=0){ xd_ne.push_back(i); } }else{ if(i%2==0){ xd_po.push_back(i); } } } for(int i=0;i<xd_po.size();i++){ if(xd_po[i]>xd_ne[i]){ x+=xd_po[i]-xd_ne[i]; }else{ x+=xd_ne[i]-xd_po[i]; } } return x; }

Compilation message (stderr)

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