Submission #581450

#TimeUsernameProblemLanguageResultExecution timeMemory
581450colossal_pepeFinancial Report (JOI21_financial)C++17
0 / 100
3389 ms468 KiB
#include <iostream> using namespace std; int n, d, a[11]; 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 + 1] > last_max); last_max = max(last_max, a[i + 1]); last_taken = i; } } return score; } int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); cin >> n >> d; for (int i = 1; i <= n; i++) { cin >> a[i]; } int score = 0; for (int i = 0; i < (1 << n); i++) { score = max(score, calc(i)); } cout << score << '\n'; return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...