-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcheglove.cpp
More file actions
52 lines (46 loc) · 865 Bytes
/
cheglove.cpp
File metadata and controls
52 lines (46 loc) · 865 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
46
47
48
49
50
51
52
#include<iostream>
#include<algorithm>
#include<climits>
#include<math.h>
#include<vector>
using namespace std;
int main()
{
int t;
cin>>t;
while(t--)
{
int n;
cin>>n;
int f[n],g[n];
for(int i=0;i<n;i++)
{
cin>>f[i];
}
for(int i=0;i<n;i++)
{
cin>>g[i];
}
int front=0,back=0;
for(int i=0;i<n;i++)
{
if(g[i]>=f[i])
{
front++;
}
if(g[n-i-1]>=f[i])
{
back++;
}
}
if(front==n&&back==n)
cout<<"both"<<endl;
else if(front==n)
cout<<"front"<<endl;
else if(back==n)
cout<<"back"<<endl;
else
cout<<"none"<<endl;
}
return 0;
}