# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
96396 | mohammad | Race (IOI11_race) | C++14 | 0 ms | 0 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#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 ;
for(int i = 1 ; i < R ; ++i){
cost[i] = X[i] - X[i - 1] ;
}
int co = 1 ;
ll c = 0 ;
for(int i = 0 ; i < R - 1 ; ++i){
c += cost[i];
if(c > B){
ans = max(ans , co);
c = cost[i] ;
co = 1 ;
if(c > B){
ans = max(ans , co);
c = 0 ;
co = 0 ;
}
}
co++;
}
ans = max(ans , co);
return ans;
}