Submission #170340

#TimeUsernameProblemLanguageResultExecution timeMemory
170340ngmhWiring (IOI17_wiring)C++11
13 / 100
37 ms3836 KiB
#include "wiring.h" #include <bits/stdc++.h> long long min_total_length(std::vector<int> r, std::vector<int> b) { long long rr, bb, t = 0; rr = r[r.size()-1]; bb = b[0]; for(int i = 0; i < r.size(); i++) t += abs(r[i]-rr); for(int i = 0; i < b.size(); i++) t += abs(b[i]-bb); return t+std::max(r.size(), b.size())*(bb-rr); }

Compilation message (stderr)

wiring.cpp: In function 'long long int min_total_length(std::vector<int>, std::vector<int>)':
wiring.cpp:8:19: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
  for(int i = 0; i < r.size(); i++) t += abs(r[i]-rr);
                 ~~^~~~~~~~~~
wiring.cpp:9:19: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
  for(int i = 0; i < b.size(); i++) t += abs(b[i]-bb);
                 ~~^~~~~~~~~~
#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...