Submission #206961

# Submission time Handle Problem Language Result Execution time Memory
206961 2020-03-06T01:56:40 Z peuch Rice Hub (IOI11_ricehub) C++17
68 / 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 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;
}

Compilation message

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 time Memory 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 6 ms 376 KB Output is correct
5 Correct 5 ms 256 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 5 ms 376 KB Output is correct
2 Correct 5 ms 424 KB Output is correct
3 Correct 5 ms 256 KB Output is correct
4 Correct 5 ms 376 KB Output is correct
5 Correct 5 ms 376 KB Output is correct
6 Correct 5 ms 256 KB Output is correct
7 Correct 5 ms 256 KB Output is correct
8 Correct 5 ms 256 KB Output is correct
9 Correct 5 ms 256 KB Output is correct
10 Correct 5 ms 256 KB Output is correct
11 Correct 5 ms 376 KB Output is correct
12 Correct 5 ms 376 KB Output is correct
13 Correct 5 ms 256 KB Output is correct
14 Correct 5 ms 256 KB Output is correct
15 Correct 5 ms 376 KB Output is correct
16 Correct 5 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 5 ms 256 KB Output is correct
20 Correct 5 ms 376 KB Output is correct
21 Correct 9 ms 256 KB Output is correct
22 Correct 9 ms 256 KB Output is correct
23 Correct 14 ms 376 KB Output is correct
24 Correct 12 ms 256 KB Output is correct
25 Correct 12 ms 376 KB Output is correct
26 Correct 12 ms 376 KB Output is correct
27 Correct 11 ms 376 KB Output is correct
28 Correct 11 ms 376 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 5 ms 376 KB Output is correct
2 Correct 6 ms 376 KB Output is correct
3 Correct 27 ms 376 KB Output is correct
4 Correct 27 ms 376 KB Output is correct
5 Correct 9 ms 376 KB Output is correct
6 Correct 9 ms 376 KB Output is correct
7 Correct 22 ms 376 KB Output is correct
8 Correct 23 ms 376 KB Output is correct
9 Correct 11 ms 256 KB Output is correct
10 Correct 11 ms 376 KB Output is correct
11 Correct 23 ms 376 KB Output is correct
12 Correct 22 ms 376 KB Output is correct
13 Correct 33 ms 376 KB Output is correct
14 Correct 33 ms 376 KB Output is correct
15 Correct 11 ms 256 KB Output is correct
16 Correct 12 ms 256 KB Output is correct
17 Correct 24 ms 376 KB Output is correct
18 Correct 22 ms 380 KB Output is correct
19 Correct 34 ms 376 KB Output is correct
20 Correct 32 ms 376 KB Output is correct
21 Correct 532 ms 504 KB Output is correct
22 Correct 527 ms 632 KB Output is correct
23 Correct 946 ms 528 KB Output is correct
24 Correct 945 ms 504 KB Output is correct
25 Correct 871 ms 632 KB Output is correct
26 Correct 884 ms 504 KB Output is correct
27 Correct 821 ms 504 KB Output is correct
28 Correct 819 ms 632 KB Output is correct
# Verdict Execution time Memory Grader output
1 Execution timed out 1089 ms 760 KB Time limit exceeded
2 Halted 0 ms 0 KB -