結果

問題 No.482 あなたの名は
ユーザー testestesttestestest
提出日時 2017-02-12 16:58:01
言語 C90
(gcc 11.4.0)
結果
WA  
実行時間 -
コード長 196 bytes
コンパイル時間 87 ms
コンパイル使用メモリ 23,528 KB
実行使用メモリ 4,384 KB
最終ジャッジ日時 2023-08-28 14:51:52
合計ジャッジ時間 1,812 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,380 KB
testcase_01 AC 1 ms
4,376 KB
testcase_02 AC 0 ms
4,376 KB
testcase_03 AC 1 ms
4,380 KB
testcase_04 AC 0 ms
4,380 KB
testcase_05 AC 0 ms
4,376 KB
testcase_06 AC 0 ms
4,376 KB
testcase_07 AC 1 ms
4,376 KB
testcase_08 WA -
testcase_09 AC 1 ms
4,376 KB
testcase_10 AC 1 ms
4,380 KB
testcase_11 AC 1 ms
4,376 KB
testcase_12 WA -
testcase_13 AC 1 ms
4,380 KB
testcase_14 WA -
testcase_15 WA -
testcase_16 WA -
testcase_17 AC 23 ms
4,380 KB
testcase_18 WA -
testcase_19 WA -
testcase_20 AC 23 ms
4,376 KB
testcase_21 WA -
testcase_22 WA -
testcase_23 AC 23 ms
4,380 KB
testcase_24 AC 23 ms
4,376 KB
testcase_25 AC 23 ms
4,380 KB
testcase_26 WA -
testcase_27 WA -
testcase_28 AC 23 ms
4,376 KB
testcase_29 AC 22 ms
4,376 KB
testcase_30 AC 1 ms
4,376 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.c:1:17: warning: data definition has no type or storage class
 long a[1<<18],k;i,j,n;
                 ^
main.c:1:17: warning: type defaults to ‘int’ in declaration of ‘i’ [-Wimplicit-int]
main.c:1:19: warning: type defaults to ‘int’ in declaration of ‘j’ [-Wimplicit-int]
 long a[1<<18],k;i,j,n;
                   ^
main.c:1:21: warning: type defaults to ‘int’ in declaration of ‘n’ [-Wimplicit-int]
 long a[1<<18],k;i,j,n;
                     ^
main.c:2:1: warning: return type defaults to ‘int’ [-Wimplicit-int]
 main(){
 ^~~~
main.c: In function ‘main’:
main.c:3:2: warning: implicit declaration of function ‘scanf’ [-Wimplicit-function-declaration]
  scanf("%d%ld",&n,&k);
  ^~~~~
main.c:3:2: warning: incompatible implicit declaration of built-in function ‘scanf’
main.c:3:2: note: include ‘<stdio.h>’ or provide a declaration of ‘scanf’
main.c:1:1:
+#include <stdio.h>
 long a[1<<18],k;i,j,n;
main.c:3:2:
  scanf("%d%ld",&n,&k);
  ^~~~~
main.c:11:5: warning: implicit declaration of function ‘puts’ [-Wimplicit-function-declaration]
  j=!puts(k&1?"NO":"YES");
     ^~~~

ソースコード

diff #

long a[1<<18],k;i,j,n;
main(){
	scanf("%d%ld",&n,&k);
	for(i=1;i<=n;i++)scanf("%d",a+i);
	for(j=1;j<=n&&k>=0;j++)if(a[j]!=j){
		i=a[j];
		a[j]=a[i];
		a[i]=i;
		k--;
	}
	j=!puts(k&1?"NO":"YES");
}
0