You are viewing a single comment's thread. Return to all comments →
//code develop by POLY in C
#include<stdio.h> int main() { int t; scanf("%d",&t); while (t--) { int n; int arr[1000]; scanf("%d",&n); for (int i=0;i<n;i++) scanf("%d",&arr[i]); int inv = 0; for (int i=0;i<n;i++) for (int j=i+1;j<n;j++) if (arr[i] > arr[j]) inv ++; if (inv%2==0) printf("YES\n"); else printf("NO\n"); } return 0; }
Seems like cookies are disabled on this browser, please enable them to open this website
Larry's Array
You are viewing a single comment's thread. Return to all comments →
//code develop by POLY in C