You are viewing a single comment's thread. Return to all comments →
int q; cin>>q; for(int k=1;k<=q;k++) { int n; cin>>n; int array[n]; for(int i=0;i<n;i++) { cin>>array[i]; } int count=0; sort(array,array+n); do { int j; for(j=0;j<(n-1);j++) { if(array[j]!=array[j+1]) { continue; } else { break; } } if(j==(n-1)) { count+=1; } }while(next_permutation(array,array+n)); cout<<count<<endl; }
can anyone suggest me why this program run successfully for testcase0 but for other test cases it show terminated due to timeout
Seems like cookies are disabled on this browser, please enable them to open this website
Tara's Beautiful Permutations
You are viewing a single comment's thread. Return to all comments →
can anyone suggest me why this program run successfully for testcase0 but for other test cases it show terminated due to timeout