이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair < int, int > PII;
#define F first
#define S second
#define mkp make_pair
#define eb emplace_back
#define all(a) a.begin(), a.end()
#define sz(a) (int)a.size()
#define y1 kekek
#define forn(x, a, b) for (int x = a; x <= b; ++x)
#define for1(x, a, b) for (int x = a; x >= b; --x)
const ll ool = 1e18 + 9;
const int N = 2e3 + 6, oo = 1e9 + 9, base = 1e9 + 7;
int n, A, B, a[N], d[N][N];
int main() {
#ifdef krauch
freopen("input.txt", "r", stdin);
#endif
cin >> n >> A >> B;
forn(i, 1, n) {
cin >> a[i];
}
forn(j, 0, 2000) d[0][j] = oo;
d[0][0] = 0;
forn(i, 1, n) {
int sum = 0;
forn(j, 0, 2000) d[i][j] = oo;
for1(j, i, 1) {
sum += a[j];
forn(k, 0, 2000) {
d[i][k | sum] = min(d[i][k | sum], d[j - 1][k] + 1);
}
}
}
int pos = 2000;
forn(i, 0, 2000) {
if (d[n][i] <= B) {
pos = i;
break;
}
}
cout << pos << "\n";
return 0;
}
# | 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... |