| # | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
|---|---|---|---|---|---|---|---|
| 106235 | abil | Bali Sculptures (APIO15_sculpture) | C++14 | 3 ms | 384 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
#define int long long
#define mk make_pair
#define sc second
#define fr first
#define pb emplace_back
#define all(s) s.begin(), s.end()
#define sz(s) ( (int)s.size() )
#define Scan(a) scanf ("%I64d", &a)
#define scan(a) scanf ("%d", &a)
#define pi pair < int, int >
using namespace std;
const long long INF = (int)1e18 + 7;
const int N = (int)2007;
const int mod = 1000000007;
pi dp[N][N];
int y[N];
int n, a, b;
int ans;
main(){
ans = INF;
cin >> n >> a >> b;
for (int i = 1; i <= n; i++){
scanf("%lld", &y[i]);
}
for (int i = 1; i <= n; i++){
for (int j = 0; j <= n; j++){
dp[i][j] = {INF, INF};
}
}
for (int i = 1; i <= n; i++){
for (int g = 1; g <= min(i, b); g++){
if ((dp[i - 1][g].fr | (dp[i - 1][g].sc + y[i])) < ((dp[i - 1][g - 1].fr | dp[i - 1][g - 1].sc) | y[i])){
dp[i][g] = {dp[i - 1][g].fr, (dp[i - 1][g].sc + y[i])};
}
else {
dp[i][g] = { (dp[i - 1][g - 1].fr | dp[i - 1][g - 1].sc) , y[i]};
}
//cout << dp[i][g].fr << ' ' << dp[i][g].sc << ' ' << i << ' ' << g << endl;
//system("pause");
}
}
for (int g = a; g <= b; g++)
ans = min(ans, (dp[n][g].fr | dp[n][g].sc));
cout << ans;
}
컴파일 시 표준 에러 (stderr) 메시지
| # | 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... | ||||
