Submission #104695

#TimeUsernameProblemLanguageResultExecution timeMemory
104695promotaWiring (IOI17_wiring)C++14
13 / 100
59 ms3832 KiB
#include <bits/stdc++.h> long long min_total_length(std::vector<int> r,std::vector<int> b){ long long minLen=0; if(b.size()<=r.size()){ int k=r.size()-b.size(); for(int i=0;i<b.size();i++){ minLen += b[i]-r[r.size()-i-1]; } for(int i=0;i<k;i++) minLen += b[0]-r[i]; } else{ int k=b.size()-r.size(); for(int i=0;i<r.size();i++){ minLen += b[i]-r[r.size()-i-1]; } for(int i=r.size();i<b.size();i++) minLen += b[i]-r[r.size()-1]; } return minLen; }

Compilation message (stderr)

wiring.cpp: In function 'long long int min_total_length(std::vector<int>, std::vector<int>)':
wiring.cpp:7:20: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
       for(int i=0;i<b.size();i++){
                   ~^~~~~~~~~
wiring.cpp:15:20: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
       for(int i=0;i<r.size();i++){
                   ~^~~~~~~~~
wiring.cpp:18:27: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
       for(int i=r.size();i<b.size();i++)
                          ~^~~~~~~~~
wiring.cpp:14:11: warning: unused variable 'k' [-Wunused-variable]
       int k=b.size()-r.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...