結果

問題 No.482 あなたの名は
ユーザー testestesttestestest
提出日時 2017-02-13 10:54:12
言語 C90
(gcc 11.4.0)
結果
AC  
実行時間 24 ms / 2,000 ms
コード長 199 bytes
コンパイル時間 81 ms
コンパイル使用メモリ 23,804 KB
実行使用メモリ 4,380 KB
最終ジャッジ日時 2023-08-28 16:23:22
合計ジャッジ時間 1,752 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,380 KB
testcase_01 AC 0 ms
4,380 KB
testcase_02 AC 0 ms
4,376 KB
testcase_03 AC 1 ms
4,376 KB
testcase_04 AC 1 ms
4,380 KB
testcase_05 AC 0 ms
4,376 KB
testcase_06 AC 0 ms
4,376 KB
testcase_07 AC 0 ms
4,376 KB
testcase_08 AC 1 ms
4,376 KB
testcase_09 AC 0 ms
4,380 KB
testcase_10 AC 0 ms
4,376 KB
testcase_11 AC 0 ms
4,376 KB
testcase_12 AC 0 ms
4,380 KB
testcase_13 AC 1 ms
4,376 KB
testcase_14 AC 1 ms
4,380 KB
testcase_15 AC 24 ms
4,380 KB
testcase_16 AC 24 ms
4,376 KB
testcase_17 AC 24 ms
4,380 KB
testcase_18 AC 24 ms
4,376 KB
testcase_19 AC 24 ms
4,376 KB
testcase_20 AC 24 ms
4,376 KB
testcase_21 AC 23 ms
4,376 KB
testcase_22 AC 24 ms
4,376 KB
testcase_23 AC 24 ms
4,380 KB
testcase_24 AC 23 ms
4,380 KB
testcase_25 AC 23 ms
4,376 KB
testcase_26 AC 24 ms
4,376 KB
testcase_27 AC 24 ms
4,380 KB
testcase_28 AC 23 ms
4,376 KB
testcase_29 AC 22 ms
4,376 KB
testcase_30 AC 0 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++)while(a[j]!=j){
		i=a[j];
		a[j]=a[i];
		a[i]=i;
		k--;
	}
	j=!puts(k&1?"NO":"YES");
}
0