제출 #581500

#제출 시각아이디문제언어결과실행 시간메모리
581500colossal_pepeFinancial Report (JOI21_financial)C++17
14 / 100
47 ms468 KiB
#include <iostream> using namespace std; const int N = 21; 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...