답안 #248976

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
248976 2020-07-13T19:51:08 Z rocks03 Bali Sculptures (APIO15_sculpture) C++14
21 / 100
21 ms 31744 KB
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define pii pair<ll,ll>
#define ff first
#define ss second
#define pb push_back
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

const int MAXN = 2e3;
int N, A, B;
ll a[MAXN], DP[MAXN+1][MAXN+1];

ll f(int pos, int gruppo){
    if(pos == N){
        if(gruppo < A || gruppo > B)
            return LLONG_MAX;
        return 0;
    }
    if(gruppo > B || gruppo+N-pos < A) return LLONG_MAX;
    if(DP[pos][gruppo] != -1) return DP[pos][gruppo];
    ll sum = 0, best = LLONG_MAX, res;
    for(int i = pos; i < N; i++){
        sum += a[i];
        res = f(i+1, gruppo+1);
        best = min(best, (sum|res));
    }
    return DP[pos][gruppo] = best;
}

main(){
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    cin >> N >> A >> B;
    for(int i = 0; i < N; i++) cin >> a[i];
    memset(DP, -1, sizeof(DP));
    cout << f(0, 0);
}

Compilation message

sculpture.cpp:31:6: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
 main(){
      ^
# 결과 실행 시간 메모리 Grader output
1 Correct 15 ms 31616 KB Output is correct
2 Correct 15 ms 31744 KB Output is correct
3 Correct 14 ms 31744 KB Output is correct
4 Correct 15 ms 31744 KB Output is correct
5 Correct 14 ms 31616 KB Output is correct
6 Correct 14 ms 31744 KB Output is correct
7 Correct 14 ms 31744 KB Output is correct
8 Correct 14 ms 31744 KB Output is correct
9 Correct 15 ms 31616 KB Output is correct
10 Correct 14 ms 31744 KB Output is correct
11 Correct 14 ms 31744 KB Output is correct
12 Correct 15 ms 31616 KB Output is correct
13 Correct 14 ms 31744 KB Output is correct
14 Correct 15 ms 31744 KB Output is correct
15 Correct 15 ms 31744 KB Output is correct
16 Correct 14 ms 31744 KB Output is correct
17 Correct 16 ms 31744 KB Output is correct
18 Correct 14 ms 31744 KB Output is correct
19 Correct 15 ms 31744 KB Output is correct
20 Correct 15 ms 31744 KB Output is correct
21 Incorrect 16 ms 31616 KB Output isn't correct
22 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 17 ms 31744 KB Output is correct
2 Correct 15 ms 31616 KB Output is correct
3 Correct 14 ms 31616 KB Output is correct
4 Correct 14 ms 31744 KB Output is correct
5 Correct 15 ms 31616 KB Output is correct
6 Correct 15 ms 31616 KB Output is correct
7 Correct 20 ms 31616 KB Output is correct
8 Correct 21 ms 31744 KB Output is correct
9 Correct 15 ms 31744 KB Output is correct
10 Correct 14 ms 31744 KB Output is correct
11 Correct 20 ms 31744 KB Output is correct
12 Correct 16 ms 31616 KB Output is correct
13 Correct 15 ms 31616 KB Output is correct
14 Correct 15 ms 31616 KB Output is correct
15 Correct 15 ms 31616 KB Output is correct
16 Correct 15 ms 31616 KB Output is correct
17 Correct 14 ms 31744 KB Output is correct
18 Correct 15 ms 31616 KB Output is correct
19 Correct 14 ms 31616 KB Output is correct
20 Correct 14 ms 31616 KB Output is correct
21 Incorrect 15 ms 31744 KB Output isn't correct
22 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 14 ms 31616 KB Output is correct
2 Correct 14 ms 31616 KB Output is correct
3 Correct 15 ms 31744 KB Output is correct
4 Correct 15 ms 31616 KB Output is correct
5 Correct 15 ms 31744 KB Output is correct
6 Correct 20 ms 31736 KB Output is correct
7 Correct 15 ms 31744 KB Output is correct
8 Correct 21 ms 31744 KB Output is correct
9 Correct 15 ms 31744 KB Output is correct
10 Correct 15 ms 31744 KB Output is correct
11 Correct 14 ms 31616 KB Output is correct
12 Correct 16 ms 31744 KB Output is correct
13 Correct 15 ms 31616 KB Output is correct
14 Correct 21 ms 31744 KB Output is correct
15 Correct 15 ms 31744 KB Output is correct
16 Correct 15 ms 31744 KB Output is correct
17 Correct 15 ms 31744 KB Output is correct
18 Correct 15 ms 31616 KB Output is correct
19 Correct 15 ms 31744 KB Output is correct
20 Correct 15 ms 31616 KB Output is correct
21 Correct 15 ms 31744 KB Output is correct
22 Correct 15 ms 31616 KB Output is correct
23 Correct 15 ms 31616 KB Output is correct
24 Correct 15 ms 31744 KB Output is correct
25 Correct 15 ms 31744 KB Output is correct
26 Correct 16 ms 31744 KB Output is correct
27 Correct 15 ms 31744 KB Output is correct
28 Correct 15 ms 31744 KB Output is correct
29 Correct 16 ms 31744 KB Output is correct
30 Correct 15 ms 31744 KB Output is correct
31 Correct 16 ms 31744 KB Output is correct
32 Correct 16 ms 31744 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 15 ms 31744 KB Output is correct
2 Correct 15 ms 31616 KB Output is correct
3 Correct 15 ms 31744 KB Output is correct
4 Correct 15 ms 31744 KB Output is correct
5 Correct 15 ms 31616 KB Output is correct
6 Correct 15 ms 31616 KB Output is correct
7 Correct 16 ms 31616 KB Output is correct
8 Correct 14 ms 31616 KB Output is correct
9 Correct 15 ms 31616 KB Output is correct
10 Correct 16 ms 31744 KB Output is correct
11 Correct 15 ms 31616 KB Output is correct
12 Correct 15 ms 31744 KB Output is correct
13 Correct 15 ms 31744 KB Output is correct
14 Correct 14 ms 31744 KB Output is correct
15 Correct 16 ms 31616 KB Output is correct
16 Correct 15 ms 31616 KB Output is correct
17 Correct 15 ms 31648 KB Output is correct
18 Correct 15 ms 31616 KB Output is correct
19 Correct 15 ms 31616 KB Output is correct
20 Correct 15 ms 31616 KB Output is correct
21 Incorrect 15 ms 31616 KB Output isn't correct
22 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 14 ms 31744 KB Output is correct
2 Correct 16 ms 31744 KB Output is correct
3 Correct 15 ms 31744 KB Output is correct
4 Correct 15 ms 31744 KB Output is correct
5 Correct 15 ms 31616 KB Output is correct
6 Correct 15 ms 31616 KB Output is correct
7 Correct 15 ms 31744 KB Output is correct
8 Correct 15 ms 31616 KB Output is correct
9 Correct 15 ms 31616 KB Output is correct
10 Correct 15 ms 31744 KB Output is correct
11 Correct 14 ms 31744 KB Output is correct
12 Correct 15 ms 31620 KB Output is correct
13 Correct 16 ms 31744 KB Output is correct
14 Correct 14 ms 31744 KB Output is correct
15 Correct 15 ms 31744 KB Output is correct
16 Correct 15 ms 31744 KB Output is correct
17 Correct 15 ms 31744 KB Output is correct
18 Incorrect 16 ms 31744 KB Output isn't correct
19 Halted 0 ms 0 KB -