結果

問題 No.482 あなたの名は
ユーザー Ryogo1008Ryogo1008
提出日時 2017-02-10 22:39:40
言語 C++11
(gcc 11.4.0)
結果
WA  
実行時間 -
コード長 584 bytes
コンパイル時間 2,030 ms
コンパイル使用メモリ 58,036 KB
実行使用メモリ 6,640 KB
最終ジャッジ日時 2023-08-27 22:42:16
合計ジャッジ時間 2,911 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

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;
ll bit [MAX_N];
int n;
ll sum(int i){
	ll s=0;
	while(i>0){
		s+=bit[i];
		i-=i&-i;
	}
	return s;
}
void add(int i,int x){
	while(i<=n){
		bit[i]+=x;
		i+=i&-i;
	}
}
ll d[MAX_N];
int main(){
	ll k;
	cin>>n>>k;
	ll ans=0;
	rep(i,n){
		cin>>d[i];
		ans+=i-sum(d[i]);
		add(d[i],1);
	}
	if(k-ans>=0 && (k-ans)%2==0)cout<<"YES"<<endl;
	else cout<<"NO"<<endl;
}
0