# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
232357 | jam_xd_ | Gondola (IOI14_gondola) | C++17 | 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 <bits/stdc++.h>
int besthub(int R, int L, int X[], long long B)
{
int rhub = 1;//thub=0;
int operaciones = 0, c_hub=0;
multiset<int>dinamic_multiset;
for(int i=0;i<X.size();i++){
if(rhub <= X[i]){
for(int j=X[i];j>=rhub;j++){
operaciones++;
if(operaciones >= B){
dinamic_multiset.insert(c_hub);
operaciones=0;
c_hub=0;
break;
}
}
c_hub++;
}
if(rhub >= X[i]){
for(int j=X[i];j<=rhub;j++){
operaciones++;
if(operaciones>=B){
dinamic_multiset.insert(c_hub);
operaciones = 0;
c_hub=0;
break;
}
}
c_hub++;
}
}
multiset<int>::iterator it = dinamic_multiset.end();
for(it = dinamic_multiset.begin(); it != dinamic_multiset.end(); it++){
if(it != dinamic_multiset.end())R = (*it);
}
/////////////////////////////////////////////////////////////////////
/*for(int i=1;i<=L;i++){
}*/
return R;
}