This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <iostream>
using namespace std;
int n, d, a[21];
int calc(int config) {
int last_taken = -1, last_max = -1, score = 0;
for (int i = 0; i < n; i++) {
if (last_taken != -1 and i - last_taken > d) return 0;
if (config&(1 << i)) {
score += (a[i] > last_max);
last_max = max(last_max, a[i]);
last_taken = i;
}
}
return score;
}
int main() {
ios_base::sync_with_stdio(false);
cin.tie(NULL);
cin >> n >> d;
for (int i = 0; i < n; i++) {
cin >> a[i];
}
if (n > 20) cout << "parbona" << '\n';
int score = 0;
for (int i = 0; i < (1 << n); i++) {
score = max(score, calc(i));
}
cout << score << '\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... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |