답안 #45338

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
45338 2018-04-13T01:15:05 Z Mamnoon_Siam 전선 연결 (IOI17_wiring) C++17
컴파일 오류
0 ms 0 KB
#include "wiring.h"

long long min_total_length(std::vector<int> r, std::vector<int> b) {
	sort(r.begin(), r.end());
	sort(b.begin(), b.end());
	int ret = 0;
	for(int i=0; i<r.size(); i++) ret += b[0] - r[i];
	for(int i=0; i<b.size(); i++) ret += b[i] - r.back();
	return ret;
}

Compilation message

wiring.cpp: In function 'long long int min_total_length(std::vector<int>, std::vector<int>)':
wiring.cpp:4:2: error: 'sort' was not declared in this scope
  sort(r.begin(), r.end());
  ^~~~
wiring.cpp:4:2: note: suggested alternative: 'short'
  sort(r.begin(), r.end());
  ^~~~
  short
wiring.cpp:7:16: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
  for(int i=0; i<r.size(); i++) ret += b[0] - r[i];
               ~^~~~~~~~~
wiring.cpp:8:16: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
  for(int i=0; i<b.size(); i++) ret += b[i] - r.back();
               ~^~~~~~~~~