Submission #581499

#TimeUsernameProblemLanguageResultExecution timeMemory
581499colossal_pepeFinancial Report (JOI21_financial)C++17
0 / 100
2190 ms468 KiB
#include <iostream> using namespace std; const int N = 15; int n, d, a[N]; 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 = (1 << (n - 1)); 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...