My issue
include <bits/stdc++.h>
using namespace std;
int main() {
int t;
cin>>t;
while(t–){
long long n,i,c=0;
cin>>n;
int a[n];
for(i=0;i<n;i++)
cin>>a[i];
if(n==1)
cout<<“Marichka”<<endl;
else{
sort(a,a+n);
for(i=n-2;i>=0;i–){
if(a[i]==a[i+1])
++c;
else
break;
}
if(c%2==0||c==0)
cout<<“Marichka”<<endl;
else
cout<<“Zenyk”<<endl;
}
}
return 0;
}
What is the error in this code
My code
#include <bits/stdc++.h>
using namespace std;
int main() {
int t;
cin>>t;
while(t--){
long long n,i,c=0;
cin>>n;
int a[n];
for(i=0;i<n;i++)
cin>>a[i];
if(n==1)
cout<<"Marichka"<<endl;
else{
sort(a,a+n);
for(i=n-2;i>=0;i--){
if(a[i]==a[i+1])
++c;
else
break;
}
if(c%2==0||c==0)
cout<<"Marichka"<<endl;
else
cout<<"Zenyk"<<endl;
}
}
return 0;
}
Problem Link: Take Not Less Practice Coding Problem