結果

問題 No.507 ゲーム大会(チーム決め)
ユーザー hiroakiehiroakie
提出日時 2017-12-25 10:12:03
言語 C++11
(gcc 11.4.0)
結果
WA  
実行時間 -
コード長 540 bytes
コンパイル時間 546 ms
コンパイル使用メモリ 62,568 KB
実行使用メモリ 4,384 KB
最終ジャッジ日時 2023-08-22 18:48:54
合計ジャッジ時間 2,638 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,376 KB
testcase_01 AC 2 ms
4,380 KB
testcase_02 AC 2 ms
4,380 KB
testcase_03 WA -
testcase_04 WA -
testcase_05 AC 1 ms
4,380 KB
testcase_06 AC 1 ms
4,380 KB
testcase_07 AC 47 ms
4,384 KB
testcase_08 WA -
testcase_09 AC 30 ms
4,380 KB
testcase_10 WA -
testcase_11 WA -
testcase_12 WA -
testcase_13 WA -
testcase_14 WA -
testcase_15 WA -
testcase_16 WA -
testcase_17 WA -
testcase_18 WA -
testcase_19 WA -
testcase_20 AC 2 ms
4,384 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <algorithm>
#include <cstring>
using namespace std;
typedef long long int ll;
const int N = 100000;
ll pt[N - 1], a, n, m,mi=n-1,mn=-1;

bool cg(int si) {
	int mi1 = n - 2 - 2 * (m - 1),mi2=mi1-1;
	if (mi1 <= si)mi1--;
	if (mi2 <= si)mi2--;
	return pt[mi1] + pt[mi2] <= a + pt[si];
}

int main() {
	cin >> n >> m;
	cin >> a;
	for (int i = 0; i < n - 1; i++)cin >> pt[i];
	sort(pt, pt + n - 1);
	for (int i = 0; i < n - 1; i++)if (cg(i)) { cout << pt[i] << endl; goto end; }
	cout << -1 << endl;
	end:return 0;
}
0