# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
617388 | Abrar_Al_Samit | Financial Report (JOI21_financial) | C++17 | 225 ms | 1484 KiB |
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<bits/stdc++.h>
using namespace std;
void PlayGround() {
int n, D;
cin>>n>>D;
int a[n+1];
for(int i=1; i<=n; ++i) {
cin>>a[i];
}
int ans = 0;
for(int mask=1; mask<(1<<n); ++mask) {
vector<int>seq;
for(int j=0; j<n; ++j) if(mask>>j&1) {
seq.push_back(j+1);
}
bool ok = 1;
for(int j=1; j<seq.size(); ++j) {
ok &= seq[j]-seq[j-1]<=D;
}
if(!ok) continue;
int cur = 0;
int mx = -1;
for(int j : seq) {
if(a[j]>mx) {
++cur;
mx = a[j];
}
}
ans = max(ans, cur);
}
cout<<ans<<'\n';
}
int main() {
ios_base::sync_with_stdio(false);
cin.tie(NULL);
PlayGround();
return 0;
}
Compilation message (stderr)
# | 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... |