結果
| 問題 |
No.507 ゲーム大会(チーム決め)
|
| コンテスト | |
| ユーザー |
#ラス+
|
| 提出日時 | 2019-11-28 10:20:57 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 2,405 bytes |
| コンパイル時間 | 1,359 ms |
| コンパイル使用メモリ | 98,476 KB |
| 実行使用メモリ | 5,248 KB |
| 最終ジャッジ日時 | 2024-11-17 12:37:54 |
| 合計ジャッジ時間 | 2,553 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 7 WA * 12 |
ソースコード
#define _USE_MATH_DEFINES
#include<iostream>
#include<algorithm>
#include<string>
#include<iomanip>
#include<cmath>
#include<vector>
#include<deque>
#include<queue>
#include<map>
#include<set>
#define ll long long
#define str string
#define ld long double
#define vec vector
#define vll vec<ll>
#define rep(i,a,b) for(ll i=a;i<b;i++)
#define rrep(i,b,a) for(ll i=b;i>=a;i--)
#define ALL(a) a.begin(),a.end()
#define rALL(a) a.rbegin(),a.rend()
#define kai "\n"
#define yuque priority_queue
#define pub push_back
#define pob pop_back
#define puf push_front
#define pof pop_front
#define mie min_element
#define mae max_element
#define tos to_string
#define sep setprecision
#define lob lower_bound
#define upb upper_bound
#define nep next_permutation
#define MOD 1000000007ll
#define MIN (1e-10)
#define equal(a,b) (abs((a)-(b))<MIN)
#define v2 ten
#define chokusen senbun
#define tenten senbun
#define takaku vec<ten>
using namespace std;
void solve();
int main(){
cin.tie(0);
ios::sync_with_stdio(false);
cout<<fixed;
solve();
}
struct pea{
ll f,s;
bool operator<(const pea &p)const{
return f!=p.f?f<p.f:s<p.s;
};
};
struct tri{
ll f,s,t;
bool operator<(const tri &p)const{
if(f!=p.f)return f<p.f;
if(s!=p.s)return s<p.s;
return t<p.t;
};
};
class ten{
public:
ld x,y;
ten operator+(ten p){return{x+p.x,y+p.y};}
ten operator-(ten p){return{x-p.x,y-p.y};}
ten operator*(ld k){return{k*x,k*y};}
ten operator/(ld k){return{x/k,y/k};}
ld abs(){return sqrt(abs2());}
ld abs2(){return x*x+y*y;};
bool operator<(const ten &p)const{return x!=p.x?x<p.x:y<p.y;};
bool operator==(const ten &p)const{return (-MIN<x-p.x)&&(x-p.x<MIN)&&(-MIN<y-p.y)&&(y-p.y<MIN);};
ld naiseki(v2 b){return x*b.x+y*b.y;}
ld gaiseki(v2 b){return x*b.y-y*b.x;}
};
struct senbun{ten p1,p2;};
struct en{ten o;ld r;};
ll n,m,p;vll a;
bool isok(ll key){
ll mine=p+a[key];
ll cnt=1;
ll sum;
for(ll i=0;i<a.size();i+=2){
if(a[i]==a[key]){
sum=a[i+1]+a[i+2];
i++;
}else if(a[i+1]==a[key]){
sum=a[i]+a[i+2];
i++;
} else sum=a[i]+a[i+1];
if(mine<sum)cnt++;
}
if(cnt<=m)return true;
return false;
}
ll minkey(ll lkey,ll rkey){
while(lkey<rkey){
ll mkey=(lkey+rkey)/2;
if(isok(mkey))rkey=mkey;
else lkey=mkey+1;
}
return lkey;
}
void solve(){
cin>>n>>m>>p;
a.resize(n-1);
rep(i,0,n-1)cin>>a[i];
sort(ALL(a));
ll k=minkey(0,n-1);
if(k==n-1)cout<<-1<<kai;
else cout<<a[k]<<kai;
}
#ラス+