# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1257772 | ilovewaguri | Financial Report (JOI21_financial) | C++20 | 4094 ms | 3908 KiB |
#include<bits/stdc++.h>
using namespace std;
#define NAME ""
#define nl '\n'
#define allof(x) x.begin(),x.end()
#define allof1(x) x.begin()+1,x.end()
#define allofa(x,sz) x,x+sz+1
#define mset(x,val) memset(x,val,sizeof(x))
#define couf(x) cout << fixed << setprecision(x)
template<class X,class Y> bool minimize(X &a, Y b){if(a>b) {a=b;return true;}return false;};
template<class X,class Y> bool maximize(X &a, Y b){if(a<b) {a=b;return true;}return false;};
typedef long long ll;
const ll mod = (long long)1e9+7;
const int INF = (int)1e9;
const int MAXN = (int)3e5+5;
int a[MAXN];
int n,d;
void ccps() {
ios_base::sync_with_stdio(0);
cin.tie(0);cout.tie(0);
if(fopen(NAME".inp","r")) {
freopen(NAME".inp","r",stdin);
freopen(NAME".out","w",stdout);
}
}
signed main() {
ccps();
cin >> n >> d;
for (int i = 1; i<=n; i++) {
cin >> a[i];
}
vector<ll> dp(n+1,1);
dp[0]=0;
for (int i = 1; i<=n; i++) {
for (int j = 0; j<i; j++) {
if(i-j<=d and a[i]>a[j]) {
maximize(dp[i],dp[j]+1);
}
}
}
cout << *max_element(allof(dp));
}
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... |