Problem 51

One comment on “Problem 51”


  • TADEPALLI

    #include
    void swap(int *a,int *b)
    {
    int temp=*a;
    *a=*b;
    *b=temp;
    }
    int main()
    {
    int m;
    scanf(“%d”,&m);
    while(m!=0)
    {
    int n,j,i,count=0;
    scanf(“%d”,&n);
    int arr[n],freq[3];
    for(i=0;i<n;i++)
    scanf("%d",&arr[i]);
    for(i=0;i<n;i++)
    {
    for(j=0;jarr[j+1])
    {
    swap(&arr[j],&arr[j+1]);
    count++;
    }
    }
    }
    if(count%2==0)
    printf(“Yes\n”);
    else
    printf(“No\n”);
    m–;
    }
    return 0;
    }