Submission #313043

#TimeUsernameProblemLanguageResultExecution timeMemory
313043kylych03Wiring (IOI17_wiring)C++14
13 / 100
46 ms3832 KiB
#include "wiring.h" #include <bits/stdc++.h> //#include "grader.cpp" using namespace std; long long min_total_length(std::vector<int> r, std::vector<int> b) { sort(r.begin(), r.end()); sort(b.begin(), b.end()); if(r.back() < b[0]){ long long sum = 0; for(int i = 0 ;i < r.size(); i++) sum += (r.back() - r[i]); for(int i = 0 ;i < b.size(); i++) sum += (b[i] - b[0]); return sum + max(r.size(), b.size()) * 1ll * (b[0] - r.back()); } return 0; }

Compilation message (stderr)

wiring.cpp: In function 'long long int min_total_length(std::vector<int>, std::vector<int>)':
wiring.cpp:11:26: 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 < r.size(); i++)
      |                        ~~^~~~~~~~~~
wiring.cpp:13:26: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   13 |         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...