답안 #206960

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
206960 2020-03-06T01:55:42 Z peuch 쌀 창고 (IOI11_ricehub) C++17
42 / 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)(upper_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 376 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 4 ms 256 KB Output is correct
2 Correct 5 ms 256 KB Output is correct
3 Correct 5 ms 256 KB Output is correct
4 Correct 5 ms 256 KB Output is correct
5 Correct 6 ms 256 KB Output is correct
6 Correct 6 ms 256 KB Output is correct
7 Correct 6 ms 256 KB Output is correct
8 Correct 7 ms 376 KB Output is correct
9 Correct 4 ms 256 KB Output is correct
10 Correct 5 ms 256 KB Output is correct
11 Correct 5 ms 256 KB Output is correct
12 Correct 5 ms 256 KB Output is correct
13 Correct 5 ms 256 KB Output is correct
14 Correct 5 ms 256 KB Output is correct
15 Correct 7 ms 256 KB Output is correct
16 Correct 7 ms 256 KB Output is correct
17 Correct 5 ms 256 KB Output is correct
18 Correct 5 ms 256 KB Output is correct
19 Correct 7 ms 256 KB Output is correct
20 Correct 7 ms 376 KB Output is correct
21 Correct 13 ms 376 KB Output is correct
22 Correct 13 ms 376 KB Output is correct
23 Correct 130 ms 480 KB Output is correct
24 Correct 127 ms 376 KB Output is correct
25 Correct 122 ms 376 KB Output is correct
26 Correct 128 ms 376 KB Output is correct
27 Correct 114 ms 376 KB Output is correct
28 Correct 108 ms 256 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 36 ms 256 KB Output is correct
2 Correct 36 ms 376 KB Output is correct
3 Execution timed out 1095 ms 376 KB Time limit exceeded
4 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 1091 ms 760 KB Time limit exceeded
2 Halted 0 ms 0 KB -