Submission #916134

#TimeUsernameProblemLanguageResultExecution timeMemory
916134AiperiiiArranging Shoes (IOI19_shoes)C++14
30 / 100
22 ms4972 KiB
#include <bits/stdc++.h> #include "shoes.h" using namespace std; #define all(x) x.begin(),x.end() #define ff first #define ss second #define pb push_back long long count_swaps(vector<int> s) { int x=abs(s[0]); vector <long long> v1,v2; for(int i=0;i<s.size();i++){ if(i%2==0 && s[i]==x)v1.pb(i); if(i%2==1 && s[i]==-x)v2.pb(i); } long long ans=0; for(int i=0;i<v1.size();i++){ ans+=abs(v1[i]-v2[i]); } return ans; }

Compilation message (stderr)

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