이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#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);
}
컴파일 시 표준 에러 (stderr) 메시지
sculpture.cpp:31:6: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
main(){
^
# | 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... |