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 <bits/stdc++.h>
using namespace std;
typedef long long lo;
typedef pair< lo,lo > PII;
#define fi first
#define int long long
#define se second
#define mp make_pair
#define pb push_back
#define fio() ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#define FOR for(int i=1;i<=n;i++)
#define mid ((start+end)/2)
#define ort ((bas+son)/2)
const lo MAX = -1000000000000000000;
const lo MIN = 1000000000000000000;
const lo inf = (1ll<<61);
const lo KOK = 100000;
const lo LOG = 30;
const lo li = 500005;
const lo mod = 1000000007;
int n,m,b[li],a[li],k,flag,t,x,y,PS[li],dp[102][102][102];
int cev;
string s;
vector<int> v;
inline int f(int sira,int son,int hak){
int cevv=inf;
if(hak>y)return inf;
if(sira>n){
if(hak<x)return 0;
return 0;
}
if(~dp[sira][son][hak])return dp[sira][son][hak];
if(sira!=n)cevv=min(cevv,f(sira+1,son,hak));
cevv=min(cevv,(f(sira+1,sira,hak+1)|(PS[sira]-PS[son])));
return dp[sira][son][hak]=cevv;
}
main(void){
memset(dp,-1,sizeof(dp));
scanf("%lld %lld %lld",&n,&x,&y);
for(int i=1;i<=n;i++)scanf("%lld",&a[i]);
FOR PS[i]=PS[i-1]+a[i];
printf("%lld\n",f(1,0,0));
return 0;
}
Compilation message (stderr)
sculpture.cpp:44:10: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
main(void){
^
sculpture.cpp: In function 'int main()':
sculpture.cpp:46:7: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
scanf("%lld %lld %lld",&n,&x,&y);
~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~
sculpture.cpp:47:28: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
for(int i=1;i<=n;i++)scanf("%lld",&a[i]);
~~~~~^~~~~~~~~~~~~~
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |