Submission #151445

#TimeUsernameProblemLanguageResultExecution timeMemory
151445dolphingarlic전선 연결 (IOI17_wiring)C++14
0 / 100
2 ms376 KiB
#include "wiring.h" #include <math.h> using namespace std; long long min_total_length(vector<int> r, vector<int> b) { long long ans = 0; if (r.size() < b.size()) swap(r, b); int rptr = 0; for (int bptr = 0; bptr < b.size(); bptr++) { do ans += abs(r[rptr++] - b[bptr]); while (r.size() - rptr >= b.size() - bptr && (bptr == b.size() - 1 || abs(r[rptr] - b[bptr] < r[rptr] - b[bptr + 1]))); } return ans; }

Compilation message (stderr)

wiring.cpp: In function 'long long int min_total_length(std::vector<int>, std::vector<int>)':
wiring.cpp:10:26: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
  for (int bptr = 0; bptr < b.size(); bptr++) {
                     ~~~~~^~~~~~~~~~
wiring.cpp:12:54: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
   while (r.size() - rptr >= b.size() - bptr && (bptr == b.size() - 1 || abs(r[rptr] - b[bptr] < r[rptr] - b[bptr + 1])));
                                                 ~~~~~^~~~~~~~~~~~~~~
#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...