Submission #892725

#TimeUsernameProblemLanguageResultExecution timeMemory
892725Lincito_31Arranging Shoes (IOI19_shoes)C++14
50 / 100
1095 ms3264 KiB
#include <bits/stdc++.h> #include "shoes.h" using namespace std; long long x=0; long long count_swaps(vector<int> s) { int con=0; while(con<s.size()){ int temp=s[con]; if(temp==0){ con++; continue; } if(temp<0){ int cero=0; for(int i=con+1;i<s.size();i++){ if(s[i]==0){ cero++; } if(s[i]==-temp){ x+=i-con-1-cero; s[i]=0; break; } } s[con]=0; }else{ int cero=0; for(int i=con+1;i<s.size();i++){ if(s[i]==0){ cero++; } if(s[i]==-temp){ x+=i-con-cero; s[i]=0; break; } } s[con]=0; } con++; } return x; }

Compilation message (stderr)

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