結果

問題 No.482 あなたの名は
ユーザー Ryogo1008
提出日時 2017-02-10 22:53:10
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
WA  
実行時間 -
コード長 417 bytes
コンパイル時間 526 ms
コンパイル使用メモリ 58,672 KB
実行使用メモリ 6,820 KB
最終ジャッジ日時 2024-12-28 08:48:51
合計ジャッジ時間 2,595 ms
ジャッジサーバーID
(参考情報)
judge5 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 22 WA * 6
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<iostream>
#include<vector>
#include<string>
using namespace std;

#define FOR(k,m,n) for(int (k)=(m);(k)<(n);(k)++)
#define rep(i,n) FOR((i),0,(n))

typedef long long ll;

const int INF=1e9+7;
const int MAX_N=2*1e5+5;
int main(){
	ll n,k;
	cin>>n>>k;
	ll ans=0;
	rep(i,n){
		int a;
		cin>>a;
		if(a!=i+1)ans++;
	}
	ans=ans/2+(ans%2);
	if(k-ans>=0 && (k-ans)%2==0)cout<<"YES"<<endl;
	else cout<<"NO"<<endl;
}
0