Submission #1104648

#TimeUsernameProblemLanguageResultExecution timeMemory
1104648theSkeletonBali Sculptures (APIO15_sculpture)C++17
0 / 100
1 ms508 KiB
#include<bits/stdc++.h> #define space <<' '<< #define endl '\n' #define inf 1e14 #define F first #define S second #define PB push_back #define PF push_front #define md(a) ((a+mod)%mod) #define MP(a,b) make_pair(a,b) #define MT(a,b,c) make_tuple(a,b,c) typedef long long ll; using namespace std; template<typename t> using heap= priority_queue<t,vector<t>,greater<t>>; const int mx = 2e3+5; const int lg = 41; int n,a,b; ll arr[mx]; bool dp[mx]; bool comp(ll a,ll b,int x){ for(int y=lg;x<=y;y--) if(((1ll<<y)&b)<((1ll<<y)&a)) return 0; return 1; } bool check(ll c,int x){ dp[0]=1; fill(dp+1,dp+1+n,0); for(int t=1;t<=n;t++){ ll s=0; for(int r=t;t-r+1<=b&&r;r--){ s+=arr[r]; if(a<=t-r+1) if(comp(s,c,x)) dp[t]|=dp[r-1]; } } return dp[n]; } int main(){ std::ios::sync_with_stdio(0); cin.tie(0);cout.tie(0); cin>>n>>a>>b; for(int t=1;t<=n;t++) cin>>arr[t]; ll c=0; int x=lg; for(;0<=x;x--) if(!check(c,x)) c+=(1ll<<x); cout<<c; return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...