제출 #104694

#제출 시각아이디문제언어결과실행 시간메모리
104694promota전선 연결 (IOI17_wiring)C++14
컴파일 에러
0 ms0 KiB
#include<bits/stdc++.h> long long min_total_length(std::vector<int> r,std::vector<int> b){ long long minLen=0; if(b.size()<=r.size()){ int k=r.size()-b.size(); for(int i=0;i<b.size();i++){ minLen += arr[i]-arr[r.size()-i-1]; } for(int i=0;i<k;i++) minLen += b[0]-r[i]; } else{ int k=b.size()-r.size(); for(int i=0;i<r.size();i++){ minLen += arr[i]-arr[r.size()-i-1]; } for(int i=r.size();i<b.size();i++) minLen += b[i]-r[r.size()-1]; } return minLen; }

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

wiring.cpp: In function 'long long int min_total_length(std::vector<int>, std::vector<int>)':
wiring.cpp:6:20: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
       for(int i=0;i<b.size();i++){
                   ~^~~~~~~~~
wiring.cpp:7:19: error: 'arr' was not declared in this scope
         minLen += arr[i]-arr[r.size()-i-1];
                   ^~~
wiring.cpp:14:20: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
       for(int i=0;i<r.size();i++){
                   ~^~~~~~~~~
wiring.cpp:15:19: error: 'arr' was not declared in this scope
         minLen += arr[i]-arr[r.size()-i-1];
                   ^~~
wiring.cpp:17:27: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
       for(int i=r.size();i<b.size();i++)
                          ~^~~~~~~~~
wiring.cpp:13:11: warning: unused variable 'k' [-Wunused-variable]
       int k=b.size()-r.size();
           ^