제출 #638911

#제출 시각아이디문제언어결과실행 시간메모리
638911luanaamorimFinancial Report (JOI21_financial)C++14
14 / 100
78 ms340 KiB
#include <bits/stdc++.h> #define MAX (int)(1e4 + 5) #define ll long long #define esq(x) (x<<1) #define dir(x) ((x<<1)|1) using namespace std; int n, k; ll h[MAX], tmp, resp, maior; int main() { cin >> n >> k; for (int i = 0; i < n; i++) { cin >> h[i]; } for (int i = 1; i < (1<<n); i++) { ll maior = -1, tmp = 0, last = -1; for (int j = 0; j < n; j++) { if (i&(1<<j)) { if (h[j] > maior) tmp++, maior = h[j]; if (j-last > k && last!=-1) tmp = -1000000000; last = j; } } resp = max(resp, tmp); } cout << resp << endl; }
#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...