Submission #206927

# Submission time Handle Problem Language Result Execution time Memory
206927 2020-03-06T00:06:27 Z peuch Rice Hub (IOI11_ricehub) C++17
0 / 100
1000 ms 16628 KB
#include "ricehub.h"
#include<bits/stdc++.h>
using namespace std;

int besthub(int R, int L, int X[], long long B)
{	
	int ans = 0;
	for(int coord = 1; coord <= L; coord++){
		int aux = 0;
		vector<long long> auxVec;
		while(X[aux] < coord || aux < R){
			auxVec.push_back(coord - X[aux]);
			aux++;
		}
		while(aux < R){
			auxVec.push_back(X[aux]);
			aux++;
		}
		sort(auxVec.begin(), auxVec.end());
		for(int i = 1; i < auxVec.size(); i++){
			auxVec[i] += auxVec[i - 1];
		}
		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:20:20: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
   for(int i = 1; i < auxVec.size(); i++){
                  ~~^~~~~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Execution timed out 1097 ms 16472 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1092 ms 16556 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1095 ms 16516 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1094 ms 16628 KB Time limit exceeded
2 Halted 0 ms 0 KB -