Submission #368102

#TimeUsernameProblemLanguageResultExecution timeMemory
368102leinad2Arranging Shoes (IOI19_shoes)C++17
50 / 100
1094 ms1900 KiB
#include "shoes.h" #include<bits/stdc++.h> using namespace std; long long count_swaps(vector<int>s) { long long ans=0; int i, j; for(i=0;i<s.size();i+=2) { for(j=i+1;j<s.size();j++) { if(s[j]==-s[i])break; } while(j>i+1) { swap(s[j-1], s[j]); ans++; j--; } if(s[i]>0)ans++; } return ans; }

Compilation message (stderr)

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