Submission #1033735

#TimeUsernameProblemLanguageResultExecution timeMemory
1033735enderArranging Shoes (IOI19_shoes)C++17
50 / 100
1095 ms3292 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){ if(s[i] < 0){ 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; } } }else { // debe ser zapato derecho int target = -s[i]; for(int j = i+1; j < s.size(); ++j){ if(s[j] == target){ for(int k = j; k > i; --k){ swap(s[k], s[k-1]); ans++; } break; } } } } return ans; }

Compilation message (stderr)

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