답안 #23089

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
23089 2017-05-02T17:42:43 Z ngkan146 Bali Sculptures (APIO15_sculpture) C++
0 / 100
0 ms 33772 KB
#include <bits/stdc++.h>
#define forinc(i,a,b) for(int i = a, _key = b; i <= _key; ++i)
#define fordec(i,a,b) for(int i = a, _key = b; i >= _key; --i)
#define fori(i,n) for(int i = 0, _key = n; i < _key; ++i)
#define ford(i,n) for(int i = n - 1; i >= 0; --i)
#define forvct(i,v) for(int i = 0, _key = v.size(); i < _key; ++i)
#define sqr(x) ((ll)x) * (x)
#define task "sculpture"
#define st first
#define nd second
#define m_p make_pair
#define m_t make_tuple
#define p_b push_back
#define p_f push_front
#define pp_b pop_back
#define pp_f pop_front
#define sn string::npos
#define heap priority_queue
#define ll long long
#define db double
#define str string
#define eps 1e-10
#define nn 2010

using namespace std;

const ll oo = 1000000000000007LL;

ll n, A, B, a[nn], s[nn], f[nn][nn];

int main()
{
   ios_base::sync_with_stdio(false);
   cin.tie(0);
   cout.tie(0);
   //srand(time(NULL));
   //freopen(task".inp","r",stdin);
   //freopen(task".out","w",stdout);
   cin >> n >> A >> B;
   forinc(i,1,n)
   {
      cin >> a[i];
      s[i] = s[i-1] + a[i];
   }
   forinc(i,1,n)
   {
      f[i][1] = s[i];
      forinc(j,2,min((ll)i,B))
      {
         f[i][j] = oo;
         forinc(ii,j-1,i-1) f[i][j] = min(f[i][j],f[ii][j-1] | (s[i] - s[ii]));
      }
   }
   ll res = oo;
   forinc(i,A,B) res = min(res,f[n][i]);
   cout << res;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 33772 KB Output is correct
2 Incorrect 0 ms 33772 KB Output isn't correct
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 33772 KB Output is correct
2 Incorrect 0 ms 33772 KB Output isn't correct
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 33772 KB Output is correct
2 Incorrect 0 ms 33772 KB Output isn't correct
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 33772 KB Output is correct
2 Incorrect 0 ms 33772 KB Output isn't correct
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 33772 KB Output is correct
2 Incorrect 0 ms 33772 KB Output isn't correct
3 Halted 0 ms 0 KB -