-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathSHUFFLE.cpp
More file actions
37 lines (35 loc) · 782 Bytes
/
SHUFFLE.cpp
File metadata and controls
37 lines (35 loc) · 782 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
#include <bits/stdc++.h>
using namespace std;
int main(void){
unsigned long long int t,i,n,k;
cin>>t;
for(i=0;i<t;i++){
cin>>n>>k;
unsigned long long int a[n],j,m,temp;
for(j=0;j<n;j++){
cin>>a[j];
}
if(k==1){
cout<<"yes"<<endl;
continue;
}
for(j=0;j<n;j++){
for(m=0;m<n-k;m++){
if(a[m] > a[m+k]){
temp = a[m];
a[m] = a[m+k];
a[m+k] =temp;
}
}
}
for(j=0;j<n-1;j++){
if(a[j]>a[j+1]){
cout<<"no"<<endl;
break;
}
}
if(j==n-1){
cout<<"yes"<<endl;
}
}
}