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 ;
const int maxn = 3e5 + 5 ;
int n, mx[maxn], d, v[maxn] ;
int main(){
cin >> n >> d ;
for(int i = 1 ; i <= n ; i++) cin >> v[i] ;
for(int i = 1 ; i <= n + 1 ; i++) mx[i] = max(mx[i-1], v[i-1]) ;
int att = 0, ans = 0 ;
for(int i = n - 1 ; i > 0 ; i--){
att += (v[i] > mx[i]) ; ans = max(ans, att+1) ;
}
cout << ans << "\n" ;
}
# | 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... |