제출 #206961

#제출 시각아이디문제언어결과실행 시간메모리
206961peuch쌀 창고 (IOI11_ricehub)C++17
68 / 100
1089 ms760 KiB
#include "ricehub.h"
#include<bits/stdc++.h>
using namespace std;

vector<long long> auxVec;

int besthub(int R, int L, int X[], long long B)
{	
	int ans = 0;
	for(int j = 0; j < R; j++){
		int aux = 0;
		int coord = X[j];
		auxVec.clear();
		while(X[aux] < coord && aux < R){
			auxVec.push_back(coord - X[aux]);
			aux++;
		}
		while(aux < R){
			auxVec.push_back(X[aux] - coord);
			aux++;
		}
		sort(auxVec.begin(), auxVec.end());
		for(int i = 1; i < auxVec.size(); i++){
			int aux = auxVec[i] + auxVec[i - 1];
			auxVec[i] = aux;
		}
		ans = max(ans, (int)(upper_bound(auxVec.begin(), auxVec.end(), B) - auxVec.begin()));
	}
	return ans;
}

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

ricehub.cpp: In function 'int besthub(int, int, int*, long long int)':
ricehub.cpp:23:20: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
   for(int i = 1; i < auxVec.size(); i++){
                  ~~^~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...