-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathgame.cpp
More file actions
42 lines (35 loc) · 967 Bytes
/
game.cpp
File metadata and controls
42 lines (35 loc) · 967 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
#include<bits/stdc++.h>
#include<algorithm>
#define pb push_back
#define mk make_pair
#define ll long long
using namespace std;
int main(){
int t;
cin>>t;
while(t--){
ll n,i;
cin>>n;
vector<ll> g1;
for(i=0;i<n;i++){
ll x;
cin>>x;
g1.push_back(x);
}
ll count=0;
ll size=g1.size();
while(size>0){
//ll length=g1.size();
ll index=distance(g1.begin(), max_element(g1.begin(), g1.end()));
//cout<<index<<" "<<g1[index]<<endl;
while(true){g1.pop_back(); if(g1.size()==index)break;
}
size=index;
//cout<<size<<endl;
count++;
}
if(count%2 !=0){ cout<<"BOB"<<endl;}
else{cout<<"ANDY"<<endl;}
}
return 0;
}