제출 #409725

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

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

wiring.cpp: In function 'int min_total_length(std::vector<int>, std::vector<int>)':
wiring.cpp:10:19: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   10 |    for(int i =0; i<r.size(); i++){
      |                  ~^~~~~~~~~
wiring.cpp:11:18: error: 'a' was not declared in this scope
   11 |     ans+= b[i] - a[i];
      |                  ^
wiring.cpp:14:28: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   14 |    for(int i = r.size(); i < b.size(); i++)
      |                          ~~^~~~~~~~~~
wiring.cpp:15:18: error: 'a' was not declared in this scope
   15 |     ans+= b[i] - a[r.size()-1];
      |                  ^
wiring.cpp:19:19: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   19 |    for(int i =0; i<b.size(); i++){
      |                  ~^~~~~~~~~
wiring.cpp:20:18: error: 'a' was not declared in this scope
   20 |     ans+= b[i] - a[i];
      |                  ^
wiring.cpp:23:28: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   23 |    for(int i = b.size(); i < r.size(); i++)
      |                          ~~^~~~~~~~~~
wiring.cpp:24:18: error: 'a' was not declared in this scope
   24 |     ans+= b[0] - a[i];
      |                  ^
wiring.cpp:8:6: warning: unused variable 'ind' [-Wunused-variable]
    8 |  int ind = 0;
      |      ^~~