結果

問題 No.507 ゲーム大会(チーム決め)
ユーザー testestesttestestest
提出日時 2017-06-15 07:21:27
言語 C
(gcc 12.3.0)
結果
TLE  
実行時間 -
コード長 290 bytes
コンパイル時間 388 ms
コンパイル使用メモリ 29,528 KB
実行使用メモリ 6,256 KB
最終ジャッジ日時 2023-10-25 06:10:39
合計ジャッジ時間 5,655 ms
ジャッジサーバーID
(参考情報)
judge11 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,348 KB
testcase_01 AC 1 ms
4,348 KB
testcase_02 AC 1 ms
4,348 KB
testcase_03 AC 1 ms
4,348 KB
testcase_04 AC 1 ms
4,348 KB
testcase_05 AC 1 ms
4,348 KB
testcase_06 AC 1 ms
4,348 KB
testcase_07 TLE -
testcase_08 -- -
testcase_09 -- -
testcase_10 -- -
testcase_11 -- -
testcase_12 -- -
testcase_13 -- -
testcase_14 -- -
testcase_15 -- -
testcase_16 -- -
testcase_17 -- -
testcase_18 -- -
testcase_19 -- -
testcase_20 -- -
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.c:1:3: warning: multi-character character constant [-Wmultichar]
    1 | a['~~'],p,q,l,r,m,k;
      |   ^~~~
main.c:1:1: warning: data definition has no type or storage class
    1 | a['~~'],p,q,l,r,m,k;
      | ^
main.c:1:1: warning: type defaults to 'int' in declaration of 'a' [-Wimplicit-int]
main.c:1:9: warning: type defaults to 'int' in declaration of 'p' [-Wimplicit-int]
    1 | a['~~'],p,q,l,r,m,k;
      |         ^
main.c:1:11: warning: type defaults to 'int' in declaration of 'q' [-Wimplicit-int]
    1 | a['~~'],p,q,l,r,m,k;
      |           ^
main.c:1:13: warning: type defaults to 'int' in declaration of 'l' [-Wimplicit-int]
    1 | a['~~'],p,q,l,r,m,k;
      |             ^
main.c:1:15: warning: type defaults to 'int' in declaration of 'r' [-Wimplicit-int]
    1 | a['~~'],p,q,l,r,m,k;
      |               ^
main.c:1:17: warning: type defaults to 'int' in declaration of 'm' [-Wimplicit-int]
    1 | a['~~'],p,q,l,r,m,k;
      |                 ^
main.c:1:19: warning: type defaults to 'int' in declaration of 'k' [-Wimplicit-int]
    1 | a['~~'],p,q,l,r,m,k;
      |                   ^
main.c:2:1: warning: return type defaults to 'int' [-Wimplicit-int]
    2 | c(int*p,int*q){return*p-*q;}
      | ^
main.c:3:1: warning: return type defaults to 'int' [-Wimplicit-int]
    3 | main(){
      | ^~~~
main.c: In function 'main':
main.c:4:15: warning: implicit declaration of function 'scanf' [-Wimplicit-function-declaration]
    4 |         for(;~scanf("%d",a+r);r++);
      |               ^~~~~
main.c:1:1: note: include '<stdio.h>' or provide a declaration of 'scanf'
  +++ |+#include <stdio.h>
    1 | a['~~'],p,q,l,r,m,k;
main.c:4:15: warning: incompatible implicit declaration of built-in function 'scanf' [-Wbuiltin-declaration-mismatch]
    4 |         for(;~scanf("%d",a+r);r++);
      |               ^~~~~
main.c:4:15: note: include '<stdio.h>' or provide a declaration of 'scanf'
main.c:5:9: warning: implicit declaration of function 'qsort' [-Wimplicit-funct

ソースコード

diff #

a['~~'],p,q,l,r,m,k;
c(int*p,int*q){return*p-*q;}
main(){
	for(;~scanf("%d",a+r);r++);
	qsort(a+3,r-3,4,c);
	l=2;
	while(r-l>1){
		m=l+r>>1;
		p=3;q=*a+1;k=0;
		while(p<q)
			p==m?p++:
			q==m?q--:
			a[p]+a[q]>a[2]+a[m]?p++,q--,k++:
			p++;
		k<a[1]?r=m:(l=m);
	}
	printf("%d",a[r]?:-1);
}
0