Submission #597148

#TimeUsernameProblemLanguageResultExecution timeMemory
597148Ahmadsm2005Wiring (IOI17_wiring)C++14
13 / 100
33 ms2508 KiB
#include "bits/stdc++.h" //#include "grader.cpp" using namespace std; long long min_total_length(std::vector<int> r, std::vector<int> b) { long long ANS=0; if(b.size()>r.size()){ for(int i=0;i<b.size();i++){ ANS+=abs(b[i]-r[min((int)r.size()-1,i)]); } } else{ int z=b.size()-1; for(int i=r.size()-1;i>=0;i--){ ANS+=abs(r[i]-b[max(z,0)]); z--; } } return ANS; }

Compilation message (stderr)

wiring.cpp: In function 'long long int min_total_length(std::vector<int>, std::vector<int>)':
wiring.cpp:7:14: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
    7 | for(int i=0;i<b.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...