bdfz_2024_summer/day2/U111091/fixed.cpp

57 lines
1.1 KiB
C++
Raw Normal View History

2024-08-05 06:31:16 +00:00
#include<bits/stdc++.h>
using namespace std;
typedef int i32;
typedef unsigned int u32;
#ifdef DEBUG
#define PRINT_VALUE(v){using namespace std;cout<<#v<<" :"<<v<<endl;}
#endif
#ifndef DEBUG
#define PRINT_VALUE(v)
#endif
const i32 MAX_N=5'0000;
i32 t,n,k,m;
u32 x[MAX_N],perfix[MAX_N+5];
template<typename T>
void set_mem(T *begin,u32 size,T value){
for(u32 i=0;i<size;i++){
begin[i]=0;
}
}
u32 one_section(){
u32 max_num=0;
for(u32 i=1;i<=n;i++){
u32 j=1;
while(x[i+j]-x[i]>m){
j++;
}
j--;
max_num = max(max_num,perfix[i+j]-perfix[i]);
}
return max_num;
}
int main(){
cin>>t;
PRINT_VALUE(t);
return 0;
for(u32 i=1;i<=t;i++){
cin>>n>>k>>m;
set_mem(perfix, n+1, 0u);
for(u32 j=1;j<=n;j++){
cin>>x[i];
}
string s;
cin>>s;
for(u32 j=0;j<s.size();j++){
if (s[j]=='1') {
perfix[j+2] = perfix[j+1] + ( x[j+2] - x[j+1] );
}
}
u32 num = max(one_section(),(u32)0);
}
}