답안 #523114

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
523114 2022-02-07T05:52:35 Z vonatlus Bali Sculptures (APIO15_sculpture) C++14
0 / 100
1 ms 320 KB
/// adil sultanov | vonat1us 

#pragma GCC optimize("O3")
//#pragma comment(linker, "/STACK:36777216")

#include<bits/stdc++.h>

#define x first
#define y second
#define pb push_back
#define sz(x) (int) x.size()
#define all(z) (z).begin(), (z).end()
 
using namespace std;

using ll = long long;
using pii = pair<int, int>;                                   

const int MOD = 1e9 + 7; 
const int INF = 1e9 + 1e2;
  
void fin() {
#ifdef AM
    freopen(".in", "r", stdin);
#endif        
}                   

const bool flag = 0;

const int N = 2e3+10;

ll dp[N][N];

void ma1n() {
    int n, L, R;
    cin >> n >> L >> R;
    vector<int> a(n);
    for (int& x : a) cin >> x;
    ll ans = (1ll<<50);
    for (int mask = 0; mask < (1<<n); ++mask) {
        ll sum = 0, res = 0;
        for (int i = 0; i < n; ++i) {
            if (mask>>i&1) {
                res |= sum;
                sum = 0;
            }
            sum += a[i];
        }
        res |= sum;
        ans = min(ans, res);
    }
    cout << ans;
    /*
    for (int i = 0; i < n; ++i) {
        dp[i][1] = (i ? dp[i-1][1] : 0ll) + a[i];
    }
    for (int k = 2; k <= R; ++k) {
        for (int i = 0; i < n; ++i) {
            ll sum = 0;            
            dp[i][k] = (1ll<<50);
            for (int j = i; j >= k-1; --j) {
                sum += a[j];
                dp[i][k] = min(dp[i][k], (dp[j-1][k-1]|sum));
            } 
        }
    }
    ll ans = (1ll<<50);
    for (int k = L; k <= R; ++k) {
        ans = min(ans, dp[n-1][k]);
    }
    cout << ans;    */
} 

int main() {
    ios_base::sync_with_stdio(0);
    cin.tie(nullptr), fin();
    int ts = 1;
    if (flag) {
        cin >> ts;
    }
    while (ts--) {
        ma1n(); 
    }
    return 0;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 204 KB Output is correct
2 Correct 1 ms 248 KB Output is correct
3 Correct 0 ms 204 KB Output is correct
4 Correct 1 ms 204 KB Output is correct
5 Incorrect 1 ms 204 KB Output isn't correct
6 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 204 KB Output is correct
2 Correct 0 ms 204 KB Output is correct
3 Correct 1 ms 204 KB Output is correct
4 Correct 0 ms 204 KB Output is correct
5 Incorrect 1 ms 204 KB Output isn't correct
6 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 204 KB Output is correct
2 Correct 0 ms 204 KB Output is correct
3 Correct 0 ms 204 KB Output is correct
4 Correct 1 ms 204 KB Output is correct
5 Incorrect 1 ms 320 KB Output isn't correct
6 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 204 KB Output is correct
2 Correct 1 ms 204 KB Output is correct
3 Correct 0 ms 204 KB Output is correct
4 Correct 0 ms 204 KB Output is correct
5 Incorrect 0 ms 320 KB Output isn't correct
6 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 204 KB Output is correct
2 Correct 0 ms 204 KB Output is correct
3 Correct 0 ms 204 KB Output is correct
4 Correct 1 ms 320 KB Output is correct
5 Incorrect 1 ms 204 KB Output isn't correct
6 Halted 0 ms 0 KB -