Submission #248724

#TimeUsernameProblemLanguageResultExecution timeMemory
248724legendArranging Shoes (IOI19_shoes)C++17
50 / 100
1091 ms1948 KiB
#include "shoes.h" #include <bits/stdc++.h> using namespace std; long long count_swaps(std::vector<int> s) { long long ans = 0; for(int i = 0;i<s.size();i+=2){ for(int j = i+1;j<s.size();j++){ if(s[j] == -s[i]){ for(int k = j;k>i+1;k--){ swap(s[k],s[k-1]); ans++; } break; } } if(s[i]>s[i+1]) ans++; } // system("pause"); return ans; }

Compilation message (stderr)

shoes.cpp: In function 'long long int count_swaps(std::vector<int>)':
shoes.cpp:7:17: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
  for(int i = 0;i<s.size();i+=2){
                ~^~~~~~~~~
shoes.cpp:8:26: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
         for(int 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...