結果
| 問題 |
No.507 ゲーム大会(チーム決め)
|
| コンテスト | |
| ユーザー |
vjudge1
|
| 提出日時 | 2025-02-23 12:39:05 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 702 bytes |
| コンパイル時間 | 1,750 ms |
| コンパイル使用メモリ | 163,156 KB |
| 実行使用メモリ | 6,824 KB |
| 最終ジャッジ日時 | 2025-02-23 12:39:08 |
| 合計ジャッジ時間 | 3,181 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 8 WA * 11 |
ソースコード
#include<bits/stdc++.h>
//#define DEBUG
const int N=1e5+10; int n,m,a[N];
bool check(int x) {
int cnt=0,l=2,r=n;
while(l<=r) {
if(l==x) l++;
if(r==x) r--;
if(l<=r) {
if(a[l]+a[r]>a[1]+a[x]) cnt++,r--;
l++;
}
}
return cnt<m;
}
int main() {
//freopen("prize.in","r",stdin);
//freopen("prize.out","w",stdout);
std::ios::sync_with_stdio(false),std::cin.tie(nullptr);
std::cin>>n>>m,a[0]=-1;
for(int i=1;i<=n;i++) std::cin>>a[i];
std::sort(a+2,a+n+1); int l=2,r=n,ans=0;
while(l<=r) {
int m=(l+r)>>1;
if(check(m)) ans=m,r=m-1;
else l=m+1;
}
std::cout<<a[ans];
return 0;
}
vjudge1