#include using namespace std; typedef unsigned int uint; typedef long long int ll; typedef unsigned long long int ull; #define debugv(v) printf("L%d %s => ",__LINE__,#v);for(auto e:v){cout< ",__LINE__,#m);for(int x=0;x<(w);x++){cout<<(m)[x]<<" ";}cout<>=1,k++)s=(s<<1)|(u&1);for(;0>=1)cout<<(s&1);}} #define TIME chrono::system_clock::now() #define MILLISEC(t) (chrono::duration_cast(t).count()) namespace{ std::chrono::system_clock::time_point t; void tic(){t=TIME;} void toc(){fprintf(stderr,"TIME : %lldms\n",MILLISEC(TIME-t));} } template ostream& operator <<(ostream &o,const pair p){o<<"("<> n >> kei; for (i=1;i<=n;++i){ memo[i]=i; pos[i]=i; } ll count = 0; for (i=1;i<=n;++i){ scanf("%lld",&x); if (x != memo[i]){ ++count; swap(memo[i],memo[pos[x]]); swap(pos[memo[i]],pos[pos[x]]); } } if ((kei-count)%2==0){ cout << "YES" << endl; }else{ cout << "NO" << endl; } return 0; }