Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <bits/stdc++.h>
- using namespace std;
- inline void max_self(int &a, int b) {
- a = max(a, b);
- }
- int main() {
- ios_base::sync_with_stdio(false);
- cin.tie(nullptr);
- cout.tie(nullptr);
- int T;
- cin >> T;
- while(T--) {
- int N;
- cin >> N;
- vector < int > a(N + 1);
- for(int i = 1; i <= N; ++i)
- cin >> a[i];
- vector < int > dp(N + 1);
- int ans = 0;
- for(int i = N - 1; i > 0; --i)
- if(a[i] < a[i + 1]) {
- dp[i] = dp[i + 1] + 1;
- a[i] = a[i + 1];
- max_self(ans, dp[i]);
- }
- cout << ans << '\n';
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment