-
Notifications
You must be signed in to change notification settings - Fork 2
/
CHEGLOVE.cpp
52 lines (50 loc) · 1003 Bytes
/
CHEGLOVE.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
#include<bits/stdc++.h>
using namespace std;
int main()
{
long int t;
cin>>t;
while(t--)
{
long int n;
cin>>n;
vector<long int>f(n);
vector<long int>g(n);
for(long int i=0;i<n;i++)
cin>>f[i];
for(long int i=0;i<n;i++)
cin>>g[i];
// cout<<ans<<endl;
int ans=0;
bool flag=1;
for(long int i=0;i<n;i++)
{
if(f[i]>g[i])
{
flag=0;
break;
}
}
if(flag)
ans+=1;
flag=1;
for(long int i=0;i<n;i++)
{
if(f[i]>g[n-1-i])
{
flag=0;
break;
}
}
if(flag)
ans+=2;
if(ans==1)
cout<<"front"<<endl;
else if(ans==2)
cout<<"back"<<endl;
else if(ans==3)
cout<<"both"<<endl;
else
cout<<"none"<<endl;
}
}