結果

問題 No.482 あなたの名は
ユーザー gigimegigime
提出日時 2017-03-12 01:01:07
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 672 bytes
コンパイル時間 1,514 ms
コンパイル使用メモリ 166,068 KB
実行使用メモリ 8,752 KB
最終ジャッジ日時 2023-09-06 19:52:54
合計ジャッジ時間 5,683 ms
ジャッジサーバーID
(参考情報)
judge15 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
8,752 KB
testcase_01 AC 2 ms
4,380 KB
testcase_02 AC 1 ms
4,376 KB
testcase_03 AC 2 ms
4,376 KB
testcase_04 AC 1 ms
4,376 KB
testcase_05 AC 1 ms
4,380 KB
testcase_06 AC 1 ms
4,380 KB
testcase_07 WA -
testcase_08 AC 2 ms
4,380 KB
testcase_09 AC 2 ms
4,380 KB
testcase_10 AC 2 ms
4,380 KB
testcase_11 AC 2 ms
4,380 KB
testcase_12 WA -
testcase_13 WA -
testcase_14 AC 2 ms
4,376 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 <bits/stdc++.h>
using namespace std;

#define FOR(i,l,r) for(int i = (int) (l);i < (int) (r);i++)
#define ALL(x) x.begin(),x.end()
template<typename T> bool chmax(T& a,const T& b){ return a < b ? (a = b,true) : false; }
template<typename T> bool chmin(T& a,const T& b){ return b < a ? (a = b,true) : false; }
typedef long long ll;

ll N,K;

int main()
{
	scanf("%lld%lld",&N,&K);
	vector<int> A(N + 1);
	FOR(i,1,N + 1){
		scanf("%d",&A [i]);
	}

	ll t = 0;
	FOR(i,1,N + 1){
		for(int j = i;j > 0;j--) if(A [j] < A [j - 1]){
			swap(A [j],A [j - 1]);
			t++;
		}
	}

	if(t <= K && (K - t) % 2 == 0){
		printf("YES\n");
	}
	else{
		printf("NO\n");
	}

	return 0;
}
0