Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<iostream>
- #include<cstdio>
- using namespace std;
- int main(){
- int t;
- scanf("%d", &t);
- while(t--){
- int n; scanf("%d", &n);
- int a[n++], i;
- for(i = 1; i < n; i++){
- scanf("%d", &a[i]);
- }
- int difference = 0, j, temp;
- for(i = 1; i < n; i++){
- for(j = n-1; j > i; j--){
- if(a[i] <= a[j]){
- temp = j - i;
- difference = max(difference, temp);
- break;
- }
- }
- }
- printf("%d \n", difference);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement