Submission #303307

#TimeUsernameProblemLanguageResultExecution timeMemory
303307IWANTTOGETGOLDINIOIArranging Shoes (IOI19_shoes)C++14
45 / 100
47 ms1920 KiB
#include <bits/stdc++.h> #include "shoes.h" using namespace std; long long count_swaps(vector <int> s) { int n=s.size()/2; if(n==1) { if(s[0]<s[1]) { return 0; } return 1; } long long ans=0,d=0; for (int i=0;i<s.size();i++){ if(s[i]<0){ ans+=abs(i-d); d+=2; } } return ans; }

Compilation message (stderr)

shoes.cpp: In function 'long long int count_swaps(std::vector<int>)':
shoes.cpp:15:16: 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=0;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...