-
Notifications
You must be signed in to change notification settings - Fork 0
/
day2.cpp
78 lines (65 loc) · 1.41 KB
/
day2.cpp
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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
#include<bits/stdc++.h>
using namespace std;
class Solution{
public:
int flag=0;
void swap(int* xp, int* yp)
{
int temp = *xp;
*xp = *yp;
*yp = temp;
}
void print(int arr[],int n){
for(int i=0;i<n;i++){
cout<<arr[i]<<"\n";
}
}
bool isFit(int arr[], int brr[], int n){
for (int i = 0; i < n - 1; i++)
{
for (int j = 0; j < n - i - 1; j++)
{
if (arr[j] > arr[j + 1])
swap(&arr[j], &arr[j + 1]);
}
}
for (int i = 0; i < n - 1; i++)
{
for (int j = 0; j < n - i - 1; j++)
{
if (brr[j] > brr[j + 1])
swap(&brr[j], &brr[j + 1]);
}
}
for(int i=0;i<n;i++)
{
if(arr[i]>brr[i])
flag=1;
break;
}
if(flag==1)
return false;
else
return true;
}
};
int main(){
int i,j,z,t,n,flag;
cin>>t;
for(z=0;z<t;z++){
flag=0;
cin>>n;
int arr[n+1];
int brr[n+1];
for(int i=0;i<n;i++)
cin>>arr[i];
for(int j=0;j<n;j++)
cin>>brr[j];
Solution ob;
ob.print(arr,n);
// if(ob.isFit(arr,brr,n)) cout<<"Yes\n";
// else
// cout<<"No\n";
}
return 0;
}