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>
#define pb push_back
#define int long long
using namespace std;
const int mod = 998244353;
const int inf = 1e9 + 20;
const int N = 1e5+5;
int32_t main(){
cin.tie(0); cout.tie(0);
ios_base::sync_with_stdio(false);
int n, d;
cin>>n>>d;
vector<int> a(n);
for(int i = 0; i < n; i++){
cin>>a[i];
}
stack<int> st;
int ans = 0;
for(int i = n-1; i >= 0; i--){
while(!st.empty() && st.top() <= a[i]) st.pop();
st.push(a[i]);
ans = max(ans, (int)st.size());
}
cout<<ans<<endl;
return 0;
}
# | 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... |