forked from kishanrajput23/leetcode-solutions-1
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathconfusingconcatenations.cpp
More file actions
45 lines (39 loc) · 853 Bytes
/
confusingconcatenations.cpp
File metadata and controls
45 lines (39 loc) · 853 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
//shree ganeshay namah
#include <bits/stdc++.h>
using namespace std;
#define fast ios_base::sync_with_stdio(false), cin.tie(nullptr), cout.tie(nullptr);
int main()
{
int tt;
cin>>tt;
while(tt--)
{
int n;
cin>>n;
int a[n];
for (int i = 0; i < n; i++)
{
cin>>a[i];
}
int max1 = 0;
for (int i = 0; i < n; i++)
{
if(a[i]>a[max1])
max1 = i;
}
if(max1 == 0){
cout<<-1<<endl;
}
else{
cout<<max1<<endl;
for (int i = 0; i < max1; i++)
cout<<a[i]<<" ";
cout<<endl;
cout<<n-max1<<endl;
for(int i =max1; i<n; i++)
cout<<a[i]<<" ";
cout<<endl;
}
}
return 0;
}