Submission #96405

# Submission time Handle Problem Language Result Execution time Memory
96405 2019-02-09T10:14:15 Z mohammad Rice Hub (IOI11_ricehub) C++14
0 / 100
5 ms 632 KB
#include "ricehub.h"
#include "iostream"
#include "vector"
#include "map"
#include "math.h"
#include "string"
#include "algorithm"
#include "set"
#include <iterator>
#include <string.h>
#include <queue>
#include <list>

using namespace	std;

typedef long long ll ;
const ll M = 998244353  ;
const ll oo = 1e13 ;

int cost[100010];

int besthub(int R, int L, int X[], long long B){
	int ans = 1 ;
	cost[0] = 0 ;
	for(int i = 1 ; i < R ; ++i){
		cost[i] = cost[i - 1] + (X[i] - X[i - 1]) + (X[i] - X[i - 1]) * (i / 3) ;
	}
	for(int i = 1 ; i < R ; ++i){
		int lo = i  , hi = R - 1 , md , best;
		while(lo <= hi){
			md = (lo + hi) / 2 ;
			if(B > (cost[md] - cost[i - 1])){
				lo = md + 1 ;
				best = md + 1 - (i - 1) ;
			}else{
				hi = md - 1 ;
			}
		}
		ans = max(ans , best);
	}
	return ans;
}

Compilation message

ricehub.cpp: In function 'int besthub(int, int, int*, long long int)':
ricehub.cpp:29:35: warning: 'best' may be used uninitialized in this function [-Wmaybe-uninitialized]
   int lo = i  , hi = R - 1 , md , best;
                                   ^~~~
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 376 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 376 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 5 ms 376 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 5 ms 632 KB Output isn't correct
2 Halted 0 ms 0 KB -