結果

問題 No.949 飲酒プログラミングコンテスト
ユーザー face4
提出日時 2019-12-12 09:44:20
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 746 bytes
コンパイル時間 912 ms
コンパイル使用メモリ 70,400 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-06-24 19:30:23
合計ジャッジ時間 2,259 ms
ジャッジサーバーID
(参考情報)
judge2 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 10 WA * 19
権限があれば一括ダウンロードができます

ソースコード

diff #

// 嘘貪欲かもしれない
#include<iostream>
#include<set>
using namespace std;

int main(){
    int n;
    cin >> n;
    int a[n+2], b[n+2];
    for(int i = 0; i <= n; i++) cin >> a[i];
    for(int i = 0; i <= n; i++) cin >> b[i];
    a[n+1] = b[n+1] = -100001;
    multiset<int> s;
    for(int i = 0; i < n; i++){
        int x;  cin >> x;
        s.insert(x);
    }
    int aind = 0, bind = 0, ans = 0;
    while(!s.empty() && a[aind]+b[bind] > 0){
        if(a[aind]-a[aind+1] > b[bind]-b[bind+1])   bind++;
        else                                        aind++;
        auto it = s.upper_bound(a[aind]+b[bind]);
        if(it == s.begin()) break;
        ans++;
        s.erase(--it);
    }
    cout << ans << endl;
    return 0;
}
0