結果

問題 No.949 飲酒プログラミングコンテスト
ユーザー ngtkanangtkana
提出日時 2020-04-13 23:17:22
言語 C++17
(gcc 13.2.0 + boost 1.83.0)
結果
TLE  
実行時間 -
コード長 805 bytes
コンパイル時間 2,330 ms
コンパイル使用メモリ 207,408 KB
実行使用メモリ 13,480 KB
最終ジャッジ日時 2024-04-08 11:16:39
合計ジャッジ時間 7,072 ms
ジャッジサーバーID
(参考情報)
judge15 / judge13
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
13,480 KB
testcase_01 AC 2 ms
6,676 KB
testcase_02 AC 2 ms
6,676 KB
testcase_03 AC 2 ms
6,676 KB
testcase_04 AC 3 ms
6,676 KB
testcase_05 TLE -
testcase_06 -- -
testcase_07 -- -
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 -- -
testcase_21 -- -
testcase_22 -- -
testcase_23 -- -
testcase_24 -- -
testcase_25 -- -
testcase_26 -- -
testcase_27 -- -
testcase_28 -- -
testcase_29 -- -
testcase_30 -- -
testcase_31 -- -
testcase_32 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<bits/stdc++.h>
#define ALL(v) std::begin(v),std::end(v)
using lint=long long;
using ld=long double;
template<class T>using numr=std::numeric_limits<T>;
int main(){
    std::cin.tie(nullptr);std::ios_base::sync_with_stdio(false);
    std::cout.setf(std::ios_base::fixed);std::cout.precision(15);
    lint n;std::cin>>n;
    std::vector<lint>a(n+1),b(n+1),d(n);
    for(lint&x:a)std::cin>>x;
    for(lint&x:b)std::cin>>x;
    for(lint&x:d)std::cin>>x;
    std::sort(ALL(d));
    auto ok=[&](auto&&f,lint i,lint j,lint k)->bool{
        return k==0
            ||d.at(k-1)<=a.at(i+1)+b.at(j)&&f(f,i+1,j,k-1)
            ||d.at(k-1)<=a.at(i)+b.at(j+1)&&f(f,i,j+1,k-1);
    };
    lint l=0,r=n+1;
    while(1<r-l){
        lint c=(l+r)/2;
        (ok(ok,0,0,c)?l:r)=c;
    }
    std::cout<<l<<'\n';
}
0