Submission #1257772

#TimeUsernameProblemLanguageResultExecution timeMemory
1257772ilovewaguriFinancial Report (JOI21_financial)C++20
0 / 100
4094 ms3908 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)

Main.cpp: In function 'void ccps()':
Main.cpp:23:16: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   23 |         freopen(NAME".inp","r",stdin);
      |         ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~
Main.cpp:24:16: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   24 |         freopen(NAME".out","w",stdout);
      |         ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~
#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...