# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
78027 | 2018-10-02T00:00:44 Z | xiaowuc1 | Bali Sculptures (APIO15_sculpture) | C++14 | 2 ms | 620 KB |
#include <bits/stdc++.h> /* unsigned seed1 = std::chrono::system_clock::now().time_since_epoch().count(); mt19937 g1.seed(seed1); ios_base::sync_with_stdio(false); cin.tie(NULL); */ using namespace std; const double PI = 2 * acos(0); typedef long long ll; typedef unsigned long long ull; typedef pair<int, int> pii; typedef pair<int, ll> pill; typedef pair<ll, ll> pll; typedef long double ld; typedef vector<vector<ll>> matrix; ll pref[2001]; int n, a, b; ll dp[2001]; ll nextDP[2001]; int main() { scanf("%d%d%d", &n, &a, &b); for(int i = 0; i < n; i++) { scanf("%lld", &pref[i+1]); pref[i+1] += pref[i]; dp[i+1] = 1LL << 60; } ll ret = 1LL << 60; for(int x = 1; x <= b; x++) { for(int i = 0; i <= n; i++) { nextDP[i] = 1LL << 60; } for(int i = 0; i < n; i++) { for(int j = i+1; j <= n; j++) { nextDP[j] = min(nextDP[j], dp[i] | (pref[j] - pref[i])); } } memcpy(dp, nextDP, sizeof(dp)); if(x >= a) { ret = min(ret, dp[n]); } } printf("%lld\n", ret); }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 376 KB | Output is correct |
2 | Incorrect | 2 ms | 384 KB | Output isn't correct |
3 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 576 KB | Output is correct |
2 | Incorrect | 2 ms | 576 KB | Output isn't correct |
3 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 576 KB | Output is correct |
2 | Incorrect | 2 ms | 576 KB | Output isn't correct |
3 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 576 KB | Output is correct |
2 | Incorrect | 2 ms | 616 KB | Output isn't correct |
3 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 620 KB | Output is correct |
2 | Incorrect | 2 ms | 620 KB | Output isn't correct |
3 | Halted | 0 ms | 0 KB | - |