結果

問題 No.482 あなたの名は
ユーザー splatatsugomasplatatsugoma
提出日時 2017-02-10 23:10:39
言語 C90
(gcc 11.4.0)
結果
WA  
実行時間 -
コード長 800 bytes
コンパイル時間 561 ms
コンパイル使用メモリ 24,616 KB
実行使用メモリ 8,760 KB
最終ジャッジ日時 2023-08-28 08:46:09
合計ジャッジ時間 5,311 ms
ジャッジサーバーID
(参考情報)
judge13 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

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

int bubblesort(int x[ ], int n)
{
    int i, j, temp,c=0;

    for (i = 0; i < n - 1; i++) {
        for (j = n - 1; j > i; j--) {
            if (x[j - 1] > x[j]) {  
                temp = x[j];        
                x[j] = x[j - 1];
                x[j - 1]= temp;
		c++;
            }
        }	
    }
//	printf("%d",c);
	return c;
}


int main(){
	int i,N,K,ary[200000],ans,flag=0;
	scanf("%d",&N);
	scanf("%d",&K);
	
	//printf("%d",N);
	//printf("%d",K);

	for(i=0;i<N;i++){
		scanf("%d",&ary[i]);
	}
	/*for(i=0;i<N;i++){
		printf("%d",ary[i]);
	}*/
	ans=bubblesort(ary,N);
	if(ans<=K){
		if((K-ans)%2==0) flag=1;
		else if((K-ans)%2==1) flag=0;
	}else flag=2;
	
	if(flag==0) printf("NO\n");
	else if(flag==1) printf("YES\n");
	else if(flag==2) printf("NO\n");
	return 0;
}
0