結果
問題 | No.602 隠されていたゲーム2 |
ユーザー | testestest |
提出日時 | 2017-12-02 00:07:50 |
言語 | C (gcc 12.3.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 423 bytes |
コンパイル時間 | 266 ms |
コンパイル使用メモリ | 29,440 KB |
実行使用メモリ | 5,376 KB |
最終ジャッジ日時 | 2024-05-05 21:27:52 |
合計ジャッジ時間 | 1,022 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge4 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
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 | 1 ms
5,376 KB |
testcase_04 | AC | 1 ms
5,376 KB |
testcase_05 | AC | 0 ms
5,376 KB |
testcase_06 | AC | 1 ms
5,376 KB |
testcase_07 | WA | - |
testcase_08 | WA | - |
testcase_09 | WA | - |
testcase_10 | AC | 1 ms
5,376 KB |
testcase_11 | WA | - |
testcase_12 | WA | - |
testcase_13 | WA | - |
testcase_14 | WA | - |
testcase_15 | AC | 1 ms
5,376 KB |
testcase_16 | AC | 5 ms
5,376 KB |
testcase_17 | AC | 8 ms
5,376 KB |
testcase_18 | AC | 21 ms
5,376 KB |
testcase_19 | AC | 24 ms
5,376 KB |
testcase_20 | AC | 20 ms
5,376 KB |
testcase_21 | AC | 19 ms
5,376 KB |
testcase_22 | WA | - |
testcase_23 | AC | 21 ms
5,376 KB |
コンパイルメッセージ
main.c:1:1: warning: data definition has no type or storage class 1 | ans; | ^~~ main.c:1:1: warning: type defaults to 'int' in declaration of 'ans' [-Wimplicit-int] main.c:2:1: warning: data definition has no type or storage class 2 | a[200000]; | ^ main.c:2:1: warning: type defaults to 'int' in declaration of 'a' [-Wimplicit-int] main.c:3:1: warning: data definition has no type or storage class 3 | n,x,y; | ^ main.c:3:1: warning: type defaults to 'int' in declaration of 'n' [-Wimplicit-int] main.c:3:3: warning: type defaults to 'int' in declaration of 'x' [-Wimplicit-int] 3 | n,x,y; | ^ main.c:3:5: warning: type defaults to 'int' in declaration of 'y' [-Wimplicit-int] 3 | n,x,y; | ^ main.c:4:1: warning: return type defaults to 'int' [-Wimplicit-int] 4 | c(int*a,int*b){return*a-*b;} | ^ main.c:5:1: warning: return type defaults to 'int' [-Wimplicit-int] 5 | f(x){ | ^ main.c: In function 'f': main.c:5:1: warning: type of 'x' defaults to 'int' [-Wimplicit-int] main.c: At top level: main.c:14:1: warning: return type defaults to 'int' [-Wimplicit-int] 14 | g(i){ | ^ main.c: In function 'g': main.c:14:1: warning: type of 'i' defaults to 'int' [-Wimplicit-int] main.c: At top level: main.c:17:1: warning: return type defaults to 'int' [-Wimplicit-int] 17 | main(){ | ^~~~ main.c: In function 'main': main.c:18:9: warning: implicit declaration of function 'scanf' [-Wimplicit-function-declaration] 18 | scanf("%d",&n); | ^~~~~ main.c:1:1: note: include '<stdio.h>' or provide a declaration of 'scanf' +++ |+#include <stdio.h> 1 | ans; main.c:18:9: warning: incompatible implicit declaration of built-in function 'scanf' [-Wbuiltin-declaration-mismatch] 18 | scanf("%d",&n); | ^~~~~ main.c:18:9: note: include '<stdio.h>' or provide a declaration of 'scanf' main.c:20:9: warning: implicit declaration of function 'qsort' [-Wimplicit-functi
ソースコード
ans; a[200000]; n,x,y; c(int*a,int*b){return*a-*b;} f(x){ int l=0,r=n; while(r-l>1){ int m=(l+r)/2; if(a[m]>x)r=m; else l=m; } return a[l]==x; } g(i){ return f(x>a[i]?x-a[i]:a[i]-x); } main(){ scanf("%d",&n); for(int i=0;i<n;i++)scanf("%d",a+i); qsort(a,n,4,c); scanf("%d%d",&x,&y); x=abs(x)+abs(y); if(f(x)){puts("1");return 0;} else{ for(int i=0;i<n;i++)if(g(i)){puts("2");return 0;} } puts("-1"); }