結果

問題 No.507 ゲーム大会(チーム決め)
ユーザー nmnmnmnmnmnmnmnmnmnmnmnmnmnm
提出日時 2017-03-19 23:36:12
言語 Python2
(2.7.18)
結果
AC  
実行時間 784 ms / 3,000 ms
コード長 584 bytes
コンパイル時間 879 ms
コンパイル使用メモリ 6,660 KB
実行使用メモリ 10,724 KB
最終ジャッジ日時 2023-09-18 07:32:00
合計ジャッジ時間 9,171 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 11 ms
6,004 KB
testcase_01 AC 12 ms
6,036 KB
testcase_02 AC 12 ms
6,096 KB
testcase_03 AC 12 ms
5,936 KB
testcase_04 AC 12 ms
5,984 KB
testcase_05 AC 11 ms
6,008 KB
testcase_06 AC 12 ms
6,140 KB
testcase_07 AC 784 ms
10,624 KB
testcase_08 AC 735 ms
10,656 KB
testcase_09 AC 727 ms
10,724 KB
testcase_10 AC 697 ms
10,700 KB
testcase_11 AC 658 ms
10,656 KB
testcase_12 AC 713 ms
10,712 KB
testcase_13 AC 736 ms
10,676 KB
testcase_14 AC 711 ms
10,604 KB
testcase_15 AC 735 ms
10,592 KB
testcase_16 AC 745 ms
10,512 KB
testcase_17 AC 11 ms
6,024 KB
testcase_18 AC 12 ms
5,992 KB
testcase_19 AC 11 ms
5,920 KB
testcase_20 AC 12 ms
6,028 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

n,m = map(int,raw_input().split())
if not 2 <= n <= 100000: exit()
if not n%2 == 0: exit()
if not 1 <= m <= n/2: exit()
x = input(); a = []
if not 1 <= x <= 1000000000: exit()
def f(d):
	b = a[:d]+a[d+1:]; c = 0
	i1 = 0; i2 = len(b)-1
	while(i1<i2):
		if b[i1]+b[i2]>a[d]+x:
			c+=1; i1+=1; i2-=1;
		else: i1+=1;
	return 1 if c < m else 0
for i in xrange(n-1):
	a.append(input())
for i in a:
	if not 1 <= i <= 1000000000: exit()
a.sort()
low = 0; high = len(a)-1
while(low < high):
	mid = (high+low)/2
	if f(mid) == 1: high = mid
	else: low = mid+1
print a[low] if f(low) == 1 else -1
0