# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
25042 | 2017-06-20T04:51:37 Z | 윤교준(#1055) | Bali Sculptures (APIO15_sculpture) | C++11 | 0 ms | 2128 KB |
#include <cstdio> #include <cstdlib> #include <cstring> #include <cmath> #include <iostream> #include <algorithm> #include <vector> #include <stack> #include <deque> #include <queue> #include <set> #include <map> #include <unordered_map> #include <bitset> #include <string> #define pb push_back #define sz(V) ((int)(V).size()) #define allv(V) ((V).begin()),((V).end()) #define befv(V) ((V)[(sz(V)-2)]) #define sorv(V) sort(allv(V)) #define univ(V) (V).erase(unique(allv(V)),(V).end()) #define upmin(a,b) (a)=min((a),(b)) #define upmax(a,b) (a)=max((a),(b)) #define INF (1100000099) #define INFLL (1100000000000000099ll) #define MAXN (2005) using namespace std; typedef long long ll; typedef pair<int, int> pii; typedef pair<ll, ll> pll; typedef pair<int, ll> pil; typedef pair<ll, int> pli; ll S[MAXN]; int Y[MAXN]; int N, A, B; ll Ans = INFLL; void input() { scanf("%d%d%d", &N, &A, &B); for(int i = 1; i <= N; i++) scanf("%d", &Y[i]); for(int i = 1; i <= N; i++) S[i] = S[i-1] + Y[i]; } ll p1_dp[105][105]; void process1() { for(int i = 0; i < 105; i++) fill(p1_dp[i], p1_dp[i]+105, INFLL); for(int i = 1; i <= N; i++) p1_dp[i][1] = S[i]; for(int i = 2; i <= N; i++) for(int j = 2; j <= i; j++) { ll &ret = p1_dp[i][j]; ret = INFLL; for(int k = j-1; k < i; k++) { //upmin(ret, p1_dp[k][j-1] | (S[i] - S[k])); ret = min(ret, (p1_dp[k][j-1] | (S[i] - S[k]))); } } for(int X = A; X <= B; X++) upmin(Ans, p1_dp[N][X]); } int main() { input(); if(N <= 100) process1(); if(INFLL <= Ans) while(1); printf("%lld\n", Ans); return 0; }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 2128 KB | Output is correct |
2 | Incorrect | 0 ms | 2128 KB | Output isn't correct |
3 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 2128 KB | Output is correct |
2 | Incorrect | 0 ms | 2128 KB | Output isn't correct |
3 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 2128 KB | Output is correct |
2 | Incorrect | 0 ms | 2128 KB | Output isn't correct |
3 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 2128 KB | Output is correct |
2 | Incorrect | 0 ms | 2128 KB | Output isn't correct |
3 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 2128 KB | Output is correct |
2 | Incorrect | 0 ms | 2128 KB | Output isn't correct |
3 | Halted | 0 ms | 0 KB | - |