#include<deque>
#include<queue>
#include<vector>
#include<algorithm>
#include<iostream>
#include<set>
#include<cmath>
#include<tuple>
#include<string>
#include<chrono>
#include<functional>
#include<iterator>
#include<random>
#include<unordered_set>
#include<array>
#include<map>
#include<iomanip>
#include<assert.h>
#include<bitset>
#include<stack>
#include<memory>
using namespace std;
typedef long long int llint;
typedef long double lldo;
#define mp make_pair
#define mt make_tuple
#define pub push_back
#define puf push_front
#define pob pop_back
#define pof pop_front
#define fir first
#define sec second
#define res resize
#define ins insert
#define era erase
/*
cout<<setprecision(20);
cin.tie(0);
ios::sync_with_stdio(false);
*/
const llint mod=1000000000;
const llint big=2.19e15+1;
const long double pai=3.141592653589793238462643383279502884197;
const long double eps=1e-15;
template <class T,class U>bool mineq(T& a,U b){if(a>b){a=b;return true;}return false;}
template <class T,class U>bool maxeq(T& a,U b){if(a<b){a=b;return true;}return false;}
llint gcd(llint a,llint b){if(a%b==0){return b;}else return gcd(b,a%b);}
llint lcm(llint a,llint b){if(a==0){return b;}return a/gcd(a,b)*b;}
template<class T> void SO(T& ve){sort(ve.begin(),ve.end());}
template<class T> void REV(T& ve){reverse(ve.begin(),ve.end());}
template<class T>llint LBI(vector<T>&ar,T in){return lower_bound(ar.begin(),ar.end(),in)-ar.begin();}
template<class T>llint UBI(vector<T>&ar,T in){return upper_bound(ar.begin(),ar.end(),in)-ar.begin();}
int besthub(int R,int L,int X[],llint B){
//配列
int ans=0,hi=0,mg=0,chu=0;
llint cost=0;
while(-1){
if(cost<=B){//伸ばす
maxeq(ans,mg+1-hi);
if(mg+1==R){return ans;}
mg++;
cost+=X[mg]-X[chu];
if((hi+mg)%2==1){chu++;}
}else{
cost-=X[chu]-X[hi];
hi++;
if((hi+mg)%2==1){chu++;}
}
}
return ans;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
2 ms |
504 KB |
Output is correct |
2 |
Correct |
4 ms |
564 KB |
Output is correct |
3 |
Correct |
2 ms |
676 KB |
Output is correct |
4 |
Correct |
2 ms |
788 KB |
Output is correct |
5 |
Correct |
2 ms |
812 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
3 ms |
944 KB |
Output is correct |
2 |
Correct |
2 ms |
948 KB |
Output is correct |
3 |
Correct |
3 ms |
948 KB |
Output is correct |
4 |
Correct |
3 ms |
948 KB |
Output is correct |
5 |
Correct |
3 ms |
948 KB |
Output is correct |
6 |
Correct |
3 ms |
948 KB |
Output is correct |
7 |
Correct |
3 ms |
948 KB |
Output is correct |
8 |
Correct |
3 ms |
948 KB |
Output is correct |
9 |
Correct |
3 ms |
948 KB |
Output is correct |
10 |
Correct |
3 ms |
948 KB |
Output is correct |
11 |
Correct |
3 ms |
948 KB |
Output is correct |
12 |
Correct |
2 ms |
956 KB |
Output is correct |
13 |
Correct |
2 ms |
956 KB |
Output is correct |
14 |
Correct |
3 ms |
956 KB |
Output is correct |
15 |
Correct |
3 ms |
956 KB |
Output is correct |
16 |
Correct |
3 ms |
980 KB |
Output is correct |
17 |
Correct |
4 ms |
980 KB |
Output is correct |
18 |
Correct |
2 ms |
980 KB |
Output is correct |
19 |
Correct |
3 ms |
980 KB |
Output is correct |
20 |
Correct |
3 ms |
996 KB |
Output is correct |
21 |
Correct |
3 ms |
1020 KB |
Output is correct |
22 |
Correct |
3 ms |
1024 KB |
Output is correct |
23 |
Correct |
2 ms |
1028 KB |
Output is correct |
24 |
Correct |
3 ms |
1028 KB |
Output is correct |
25 |
Correct |
3 ms |
1152 KB |
Output is correct |
26 |
Correct |
3 ms |
1152 KB |
Output is correct |
27 |
Correct |
3 ms |
1152 KB |
Output is correct |
28 |
Correct |
3 ms |
1152 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
3 ms |
1152 KB |
Output is correct |
2 |
Correct |
2 ms |
1152 KB |
Output is correct |
3 |
Correct |
3 ms |
1152 KB |
Output is correct |
4 |
Correct |
3 ms |
1152 KB |
Output is correct |
5 |
Correct |
4 ms |
1152 KB |
Output is correct |
6 |
Correct |
3 ms |
1152 KB |
Output is correct |
7 |
Correct |
4 ms |
1152 KB |
Output is correct |
8 |
Correct |
4 ms |
1152 KB |
Output is correct |
9 |
Correct |
4 ms |
1152 KB |
Output is correct |
10 |
Correct |
4 ms |
1152 KB |
Output is correct |
11 |
Correct |
3 ms |
1152 KB |
Output is correct |
12 |
Correct |
3 ms |
1152 KB |
Output is correct |
13 |
Correct |
3 ms |
1156 KB |
Output is correct |
14 |
Correct |
4 ms |
1180 KB |
Output is correct |
15 |
Correct |
4 ms |
1180 KB |
Output is correct |
16 |
Correct |
3 ms |
1192 KB |
Output is correct |
17 |
Correct |
3 ms |
1196 KB |
Output is correct |
18 |
Correct |
3 ms |
1196 KB |
Output is correct |
19 |
Correct |
3 ms |
1196 KB |
Output is correct |
20 |
Correct |
3 ms |
1236 KB |
Output is correct |
21 |
Correct |
5 ms |
1372 KB |
Output is correct |
22 |
Correct |
3 ms |
1372 KB |
Output is correct |
23 |
Correct |
5 ms |
1372 KB |
Output is correct |
24 |
Correct |
5 ms |
1372 KB |
Output is correct |
25 |
Correct |
5 ms |
1436 KB |
Output is correct |
26 |
Correct |
4 ms |
1436 KB |
Output is correct |
27 |
Correct |
3 ms |
1436 KB |
Output is correct |
28 |
Correct |
4 ms |
1476 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
6 ms |
1648 KB |
Output is correct |
2 |
Correct |
10 ms |
1908 KB |
Output is correct |
3 |
Correct |
21 ms |
3196 KB |
Output is correct |
4 |
Correct |
22 ms |
4392 KB |
Output is correct |
5 |
Correct |
16 ms |
4428 KB |
Output is correct |
6 |
Correct |
13 ms |
4768 KB |
Output is correct |
7 |
Correct |
22 ms |
5748 KB |
Output is correct |
8 |
Correct |
18 ms |
6520 KB |
Output is correct |
9 |
Correct |
13 ms |
6524 KB |
Output is correct |
10 |
Correct |
10 ms |
6940 KB |
Output is correct |
11 |
Correct |
35 ms |
8128 KB |
Output is correct |
12 |
Correct |
22 ms |
9192 KB |
Output is correct |
13 |
Correct |
10 ms |
9364 KB |
Output is correct |
14 |
Correct |
15 ms |
9748 KB |
Output is correct |
15 |
Correct |
18 ms |
10648 KB |
Output is correct |
16 |
Correct |
19 ms |
11436 KB |
Output is correct |
17 |
Correct |
23 ms |
12480 KB |
Output is correct |
18 |
Correct |
27 ms |
13480 KB |
Output is correct |
19 |
Correct |
28 ms |
14544 KB |
Output is correct |
20 |
Correct |
37 ms |
15420 KB |
Output is correct |