Submission #846930

#TimeUsernameProblemLanguageResultExecution timeMemory
846930AbitoFinancial Report (JOI21_financial)C++17
0 / 100
4038 ms2652 KiB
#pragma optimize("O2") #pragma optimize("unroll-loops") #include <bits/stdc++.h> #define F first #define S second #define pb push_back #define ppb pop_back #define ep insert #define endl '\n' #define elif else if #define pow pwr #define sqrt sqrtt //#define int long long #define y1 YONE typedef unsigned long long ull; using namespace std; const int N=3e5+5; int a[N],n,d,dp[N]; int32_t main(){ ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL); cin>>n>>d; for (int i=1;i<=n;i++) cin>>a[i]; int ans=0; for (int i=1;i<=n;i++){ dp[i]=1; int x=i; for (int j=i-1;j;j--){ if (x-j>d) break; if (a[j]<a[i]) dp[i]=max(dp[i],dp[j]+1); x=j; }ans=max(ans,dp[i]); }cout<<ans<<endl; return 0; }

Compilation message (stderr)

Main.cpp:1: warning: ignoring '#pragma optimize ' [-Wunknown-pragmas]
    1 | #pragma optimize("O2")
      | 
Main.cpp:2: warning: ignoring '#pragma optimize ' [-Wunknown-pragmas]
    2 | #pragma optimize("unroll-loops")
      |
#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...