제출 #822945

#제출 시각아이디문제언어결과실행 시간메모리
822945mindiyak전선 연결 (IOI17_wiring)C++14
13 / 100
19 ms1864 KiB
#include "wiring.h" #include <queue> #include <algorithm> #include <iostream> using namespace std; #define ll long long long long min_total_length(std::vector<int> r, std::vector<int> b) { ll ans=0; int b_counter=0,r_counter = 0; for(int i=0;i<r.size();i++){ if(b_counter >= b.size()){ ans += abs(r[i]-b[0]); }else{ ans += abs(r[i]-b[b_counter]); } b_counter++; } for(int i=b_counter;i<b.size();i++){ ans += abs(r[r.size()-1]-b[i]); } return ans; }

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

wiring.cpp: In function 'long long int min_total_length(std::vector<int>, std::vector<int>)':
wiring.cpp:13:15: 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<r.size();i++){
      |              ~^~~~~~~~~
wiring.cpp:14:16: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   14 |   if(b_counter >= b.size()){
      |      ~~~~~~~~~~^~~~~~~~~~~
wiring.cpp:21:23: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   21 |  for(int i=b_counter;i<b.size();i++){
      |                      ~^~~~~~~~~
wiring.cpp:12:18: warning: unused variable 'r_counter' [-Wunused-variable]
   12 |  int b_counter=0,r_counter = 0;
      |                  ^~~~~~~~~
#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...