結果

問題 No.949 飲酒プログラミングコンテスト
ユーザー ngtkanangtkana
提出日時 2020-04-13 23:21:52
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
MLE  
実行時間 -
コード長 958 bytes
コンパイル時間 3,951 ms
コンパイル使用メモリ 218,060 KB
実行使用メモリ 594,580 KB
最終ジャッジ日時 2024-04-08 11:29:31
合計ジャッジ時間 10,218 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
13,480 KB
testcase_01 AC 2 ms
6,676 KB
testcase_02 AC 1 ms
6,676 KB
testcase_03 AC 2 ms
6,676 KB
testcase_04 AC 2 ms
6,676 KB
testcase_05 AC 2 ms
6,676 KB
testcase_06 AC 2 ms
6,676 KB
testcase_07 AC 2 ms
6,676 KB
testcase_08 AC 5 ms
6,676 KB
testcase_09 AC 2 ms
6,676 KB
testcase_10 AC 2 ms
6,676 KB
testcase_11 AC 470 ms
82,816 KB
testcase_12 AC 46 ms
12,544 KB
testcase_13 AC 44 ms
11,648 KB
testcase_14 AC 97 ms
21,760 KB
testcase_15 AC 2,486 ms
400,128 KB
testcase_16 MLE -
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));
    std::map<std::tuple<lint,lint,lint>,lint>map;
    auto ok=[&](auto&&f,lint i,lint j,lint k)->bool{
        if(auto it=map.find(std::tuple(i,j,k));it!=map.end())return it->second;
        return map[std::tuple(i,j,k)]=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