結果

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

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 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 1 ms
4,348 KB
testcase_05 AC 2 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 AC 1 ms
4,348 KB
testcase_11 AC 2 ms
4,348 KB
testcase_12 AC 1 ms
4,348 KB
testcase_13 AC 1 ms
4,348 KB
testcase_14 AC 2 ms
4,348 KB
testcase_15 TLE -
testcase_16 -- -
testcase_17 -- -
testcase_18 -- -
testcase_19 -- -
testcase_20 -- -
testcase_21 -- -
testcase_22 -- -
testcase_23 -- -
testcase_24 -- -
testcase_25 -- -
testcase_26 -- -
testcase_27 -- -
testcase_28 -- -
testcase_29 -- -
testcase_30 -- -
権限があれば一括ダウンロードができます

ソースコード

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);
		if(t!=i)
			d.push_back(t);
	}
	auto end=d.end();
	for(auto it=d.begin();it<end;it++){
		auto l=min_element(it,end);
		if(it!=l){
			swap(*it,*l);
			w++;
		}
	}
	puts((w^k)&1?"NO":"YES");
	return 0;
}
0