제출 #70574

#제출 시각아이디문제언어결과실행 시간메모리
70574Kmcode전선 연결 (IOI17_wiring)C++14
13 / 100
50 ms14180 KiB
#include <bits/stdc++.h> using namespace std; #include "wiring.h" long long min_total_length(std::vector<int> r, std::vector<int> b) { int rr=r.size()-1; int bb=0; long long int dist=0; while(rr<r.size()||bb<b.size()){ if(bb>=b.size()){ dist+=b[0]-r[rr]; rr--; continue; } if(rr<0){ dist+=b[bb]-r.back(); bb++; continue; } dist+=b[min((int)b.size()-1,bb)]-r[max(0,rr)]; rr--; bb++; } return dist; }

컴파일 시 표준 에러 (stderr) 메시지

wiring.cpp: In function 'long long int min_total_length(std::vector<int>, std::vector<int>)':
wiring.cpp:12:10: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
  while(rr<r.size()||bb<b.size()){
        ~~^~~~~~~~~
wiring.cpp:12:23: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
  while(rr<r.size()||bb<b.size()){
                     ~~^~~~~~~~~
wiring.cpp:13:8: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
   if(bb>=b.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...