GFPOOL - editorial

Problem link :
https://www.codechef.com/ABCC2020/problems/GFPOOL

Author:

Explanation:

The simple idea is that if the board doesn’t contain 8 ball then it is impossible to find out who will win.In that case you have to print impossible .It is clear that the player who contains more prime numbered ball he/she will lose .But if it’s equal than Aimon will win cause at a certain time , that turn goes with Aimon and he always sink stripe ball .

Solution in CPP :

#include <bits/stdc++.h>
using namespace std;
#define fastio ios_base::sync_with_stdio(false);cin.tie(NULL);
#define precise cout.precision(10); cout << fixed;
#define endl “\n”
#define int int64_t
#define ll long long
#define yes printf(“YES\n”)
#define no printf(“NO\n”)

int32_t main()
{
/#ifndef ONLINE_JUDGE
freopen("/media/AIMON/SSDVol/Progs/CodeForces/input.txt", “r”, stdin);
freopen("/media/AIMON/SSDVol/Progs/CodeForces/output.txt", “w”, stdout);
#endif
/
int a[100001],b[100001],c,d,e,f,m,n,p,x,y,z,t,i,j,k;
vector< int >v;
vector< int >vc;
vector< int >vn;
cin>>t;
while(t–)
{
c=0,d=0;
cin>>n;
for(i=0; i<n; i++)
{
cin>>a[i];
if(a[i]<8)
v.push_back(a[i]);
else if(a[i]>8)
vc.push_back(a[i]);
else if(a[i]==8)
vn.push_back(a[i]);
}
if(vn.size()==0)
cout<<“Impossible”<<endl;
else
{
for(i=0; i<v.size(); i++)
{
if(v[i]==2||v[i]==3||v[i]==5||v[i]==7)
c++;
}
for(i=0; i<vc.size(); i++)
{
if(vc[i]==11||vc[i]==13)
d++;
}
if(d<=c)
cout<<“Aimon”<<endl;
else
cout<<“XYZ”<<endl;
}
v.clear();
vc.clear();
vn.clear();
}
}