結果

問題 No.482 あなたの名は
ユーザー tabataba
提出日時 2017-05-18 03:55:11
言語 C++17
(gcc 13.2.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 511 bytes
コンパイル時間 981 ms
コンパイル使用メモリ 105,612 KB
実行使用メモリ 4,348 KB
最終ジャッジ日時 2023-10-18 00:09:10
合計ジャッジ時間 2,526 ms
ジャッジサーバーID
(参考情報)
judge12 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,348 KB
testcase_01 AC 2 ms
4,348 KB
testcase_02 AC 2 ms
4,348 KB
testcase_03 AC 1 ms
4,348 KB
testcase_04 AC 2 ms
4,348 KB
testcase_05 AC 1 ms
4,348 KB
testcase_06 AC 2 ms
4,348 KB
testcase_07 AC 2 ms
4,348 KB
testcase_08 WA -
testcase_09 WA -
testcase_10 WA -
testcase_11 WA -
testcase_12 WA -
testcase_13 AC 2 ms
4,348 KB
testcase_14 WA -
testcase_15 WA -
testcase_16 WA -
testcase_17 AC 26 ms
4,348 KB
testcase_18 WA -
testcase_19 WA -
testcase_20 AC 27 ms
4,348 KB
testcase_21 WA -
testcase_22 WA -
testcase_23 AC 27 ms
4,348 KB
testcase_24 AC 26 ms
4,348 KB
testcase_25 AC 27 ms
4,348 KB
testcase_26 WA -
testcase_27 WA -
testcase_28 AC 26 ms
4,348 KB
testcase_29 AC 25 ms
4,348 KB
testcase_30 AC 2 ms
4,348 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <cstdio>
#include <cstring>
#include <random>
#include <vector>
#include <algorithm>
#include <array>
#include <functional>
#include <utility>

using namespace std;

int main(){
	int n,w=0;
	int64_t k;
	int _=scanf("%d%ld",&n,&k);
	vector<int> d;
	for(int i=1;i<=n;i++){
		int t;
		_=scanf("%d",&t);
		d.push_back(t-1);
	}
	auto end=d.end();
	for(auto i=0;i<n;i++){
		auto l=d[i];
		if(i!=l){
			swap(d[i],d[l]);
			w++;
		}
	}
	puts(w<=k&&((w^k)&1)?"NO":"YES");
	//printf("%d %ld\n",w,k);
	return 0;
}
0