답안 #461497

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
461497 2021-08-10T02:53:47 Z ponytail Bali Sculptures (APIO15_sculpture) C++17
0 / 100
1 ms 308 KB
#pragma GCC optimize("Ofast")
#include <bits/stdc++.h>
#define int long long
using namespace std;
const int MAXN = 6e5 + 10;
const int MOD = 1e9 + 7;
void solve(int tc){
    int N; cin >> N;
    int A, B; cin >> A >> B;
    int Y[N+1]; for(int i=1; i<=N; i++) cin >> Y[i];
    int dp[N+1][N+1];
    int ps[N+1];
    ps[0]=0;
    for(int i=1; i<=N; i++){
        ps[i]=ps[i-1]+Y[i];
        dp[1][i]=ps[i];
    }
    for(int i=2; i<=N; i++){
        for(int j=i; j<=N; j++){
            dp[i][j]=1e18;
            for(int k=i-1; k<j; k++){
                dp[i][j]=min(dp[i][j],dp[i-1][k]|(ps[j]-ps[k]));
            }
        }
    }
    int ans=1e18;
    for(int i=A; i<=B; i++) ans = min(ans, dp[i][N]);
    cout << ans << endl;
}
signed main(){
    ios::sync_with_stdio(0); cin.tie(0);
    int t = 1; // cin >> t;
    int cnt = 0;
    while(t--) solve(++cnt);
}
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 204 KB Output is correct
2 Incorrect 1 ms 204 KB Output isn't correct
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 204 KB Output is correct
2 Incorrect 1 ms 204 KB Output isn't correct
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 204 KB Output is correct
2 Incorrect 0 ms 204 KB Output isn't correct
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 204 KB Output is correct
2 Incorrect 1 ms 308 KB Output isn't correct
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 204 KB Output is correct
2 Incorrect 0 ms 204 KB Output isn't correct
3 Halted 0 ms 0 KB -