Submission #751220

#TimeUsernameProblemLanguageResultExecution timeMemory
751220kusmetliqArranging Shoes (IOI19_shoes)C++14
45 / 100
23 ms3128 KiB
#include "shoes.h" #include<bits/stdc++.h> using namespace std; long long count_swaps(vector<int> s) { int n=s.size(); int curcnt=0; long long ans=0; for(int i=0;i<s.size();i++) { if(s[i]<0) { ans+=abs(i-(curcnt*2)); curcnt++; } } return ans; }

Compilation message (stderr)

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