結果
問題 | No.482 あなたの名は |
ユーザー | kotatsugame |
提出日時 | 2017-02-13 01:06:29 |
言語 | C90 (gcc 11.4.0) |
結果 |
AC
|
実行時間 | 28 ms / 2,000 ms |
コード長 | 212 bytes |
コンパイル時間 | 89 ms |
コンパイル使用メモリ | 20,096 KB |
実行使用メモリ | 5,376 KB |
最終ジャッジ日時 | 2024-06-09 10:11:43 |
合計ジャッジ時間 | 1,632 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge2 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 1 ms
5,248 KB |
testcase_01 | AC | 1 ms
5,376 KB |
testcase_02 | AC | 1 ms
5,376 KB |
testcase_03 | AC | 0 ms
5,376 KB |
testcase_04 | AC | 0 ms
5,376 KB |
testcase_05 | AC | 0 ms
5,376 KB |
testcase_06 | AC | 1 ms
5,376 KB |
testcase_07 | AC | 0 ms
5,376 KB |
testcase_08 | AC | 1 ms
5,376 KB |
testcase_09 | AC | 0 ms
5,376 KB |
testcase_10 | AC | 0 ms
5,376 KB |
testcase_11 | AC | 1 ms
5,376 KB |
testcase_12 | AC | 1 ms
5,376 KB |
testcase_13 | AC | 0 ms
5,376 KB |
testcase_14 | AC | 1 ms
5,376 KB |
testcase_15 | AC | 27 ms
5,376 KB |
testcase_16 | AC | 28 ms
5,376 KB |
testcase_17 | AC | 27 ms
5,376 KB |
testcase_18 | AC | 26 ms
5,376 KB |
testcase_19 | AC | 27 ms
5,376 KB |
testcase_20 | AC | 26 ms
5,376 KB |
testcase_21 | AC | 27 ms
5,376 KB |
testcase_22 | AC | 27 ms
5,376 KB |
testcase_23 | AC | 27 ms
5,376 KB |
testcase_24 | AC | 27 ms
5,376 KB |
testcase_25 | AC | 27 ms
5,376 KB |
testcase_26 | AC | 27 ms
5,376 KB |
testcase_27 | AC | 27 ms
5,376 KB |
testcase_28 | AC | 27 ms
5,376 KB |
testcase_29 | AC | 24 ms
5,376 KB |
testcase_30 | AC | 1 ms
5,376 KB |
コンパイルメッセージ
main.c:1:8: warning: data definition has no type or storage class 1 | long k;c,n,d[1<<18],u[1<<18]; | ^ main.c:1:8: warning: type defaults to ‘int’ in declaration of ‘c’ [-Wimplicit-int] main.c:1:10: warning: type defaults to ‘int’ in declaration of ‘n’ [-Wimplicit-int] 1 | long k;c,n,d[1<<18],u[1<<18]; | ^ main.c:1:12: warning: type defaults to ‘int’ in declaration of ‘d’ [-Wimplicit-int] 1 | long k;c,n,d[1<<18],u[1<<18]; | ^ main.c:1:21: warning: type defaults to ‘int’ in declaration of ‘u’ [-Wimplicit-int] 1 | long k;c,n,d[1<<18],u[1<<18]; | ^ main.c:6:1: warning: return type defaults to ‘int’ [-Wimplicit-int] 6 | main(i) | ^~~~ main.c: In function ‘main’: main.c:6:1: warning: type of ‘i’ defaults to ‘int’ [-Wimplicit-int] main.c:8:13: warning: implicit declaration of function ‘scanf’ [-Wimplicit-function-declaration] 8 | for(scanf("%d%ld",&n,&k);~scanf("%d",d+i++);); | ^~~~~ main.c:1:1: note: include ‘<stdio.h>’ or provide a declaration of ‘scanf’ +++ |+#include <stdio.h> 1 | long k;c,n,d[1<<18],u[1<<18]; main.c:8:13: warning: incompatible implicit declaration of built-in function ‘scanf’ [-Wbuiltin-declaration-mismatch] 8 | for(scanf("%d%ld",&n,&k);~scanf("%d",d+i++);); | ^~~~~ main.c:8:13: note: include ‘<stdio.h>’ or provide a declaration of ‘scanf’ main.c:10:12: warning: implicit declaration of function ‘puts’ [-Wimplicit-function-declaration] 10 | i=!puts(k<0||k%2?"NO":"YES"); | ^~~~ main.c:10:12: note: include ‘<stdio.h>’ or provide a declaration of ‘puts’
ソースコード
long k;c,n,d[1<<18],u[1<<18]; int dfs(int v) { u[v]?k-=c-1:(u[v]=1,c++,dfs(d[v])); } main(i) { for(scanf("%d%ld",&n,&k);~scanf("%d",d+i++);); for(i=0;i++<n;)!u[i]&&(c=0,dfs(i)); i=!puts(k<0||k%2?"NO":"YES"); }