We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent f046236 commit 693f07bCopy full SHA for 693f07b
1579E1.cpp
@@ -0,0 +1,26 @@
1
+#include<bits/stdc++.h>
2
+using namespace std;
3
+
4
+int main(){
5
+ int t;
6
+ cin>>t;
7
8
+ int n;
9
+ while(t--){
10
+ deque <int> deqs;
11
+ cin>>n;
12
+ int x;
13
+ for(int i = 0; i < n;i++){
14
+ cin>>x;
15
+ if(x > deqs.front()){
16
+ deqs.push_back(x);
17
+ continue;
18
+ }
19
+ deqs.push_front(x);
20
21
+ for(int i = 0; i < n; i++){
22
+ cout<<deqs.at(i)<<" ";
23
24
+ cout<<endl;
25
26
+}
0 commit comments