제출 #409727

#제출 시각아이디문제언어결과실행 시간메모리
409727dreezyWiring (IOI17_wiring)C++17
컴파일 에러
0 ms0 KiB
#include <bits/stdc++.h>
using namespace std;
#define ll long long

ll min_total_length(vector<int> r, vector<int> b){
	
	long long ans = 0;
	if(r.size() < b.size()){
			for(int i =0; i<r.size(); i++){
				ans+= b[i] - r[i];
			}
			
			for(int i = r.size(); i < b.size(); i++)
				ans+= b[i] - r[r.size()-1];
	
	}
	else{
			for(int i =0; i<b.size(); i++){
				ans+= b[i] - r[i];
			}
			
			for(int i = b.size(); i < r.size(); i++)
				ans+= b[0] - r[i];
		
	}

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

wiring.cpp: In function 'long long int min_total_length(std::vector<int>, std::vector<int>)':
wiring.cpp:9:19: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
    9 |    for(int i =0; i<r.size(); i++){
      |                  ~^~~~~~~~~
wiring.cpp:13:28: 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 = r.size(); i < b.size(); i++)
      |                          ~~^~~~~~~~~~
wiring.cpp:18:19: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   18 |    for(int i =0; i<b.size(); i++){
      |                  ~^~~~~~~~~
wiring.cpp:22:28: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   22 |    for(int i = b.size(); i < r.size(); i++)
      |                          ~~^~~~~~~~~~
wiring.cpp:25:2: error: expected '}' at end of input
   25 |  }
      |  ^
wiring.cpp:5:50: note: to match this '{'
    5 | ll min_total_length(vector<int> r, vector<int> b){
      |                                                  ^
wiring.cpp:25:2: warning: no return statement in function returning non-void [-Wreturn-type]
   25 |  }
      |  ^