답안 #206957

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
206957 2020-03-06T01:51:35 Z peuch 쌀 창고 (IOI11_ricehub) C++17
17 / 100
1000 ms 760 KB
#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 coord = 1; coord <= L; coord++){
		int aux = 0;
		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)(lower_bound(auxVec.begin(), auxVec.end(), B) - auxVec.begin()));
	}
	return ans;
}

Compilation message

ricehub.cpp: In function 'int besthub(int, int, int*, long long int)':
ricehub.cpp:22:20: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
   for(int i = 1; i < auxVec.size(); i++){
                  ~~^~~~~~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 5 ms 256 KB Output is correct
2 Correct 5 ms 256 KB Output is correct
3 Correct 5 ms 376 KB Output is correct
4 Correct 5 ms 376 KB Output is correct
5 Correct 5 ms 256 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 5 ms 376 KB Output is correct
2 Incorrect 5 ms 256 KB Output isn't correct
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 37 ms 376 KB Output is correct
2 Correct 36 ms 256 KB Output is correct
3 Execution timed out 1091 ms 376 KB Time limit exceeded
4 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 1089 ms 760 KB Time limit exceeded
2 Halted 0 ms 0 KB -