結果

問題 No.1715 Dinner 2
ユーザー hiikunZhiikunZ
提出日時 2022-05-15 15:23:59
言語 C++17
(gcc 13.2.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 1,297 bytes
コンパイル時間 2,253 ms
コンパイル使用メモリ 208,432 KB
実行使用メモリ 4,376 KB
最終ジャッジ日時 2023-10-09 23:54:39
合計ジャッジ時間 3,767 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,352 KB
testcase_01 AC 1 ms
4,352 KB
testcase_02 AC 1 ms
4,348 KB
testcase_03 AC 1 ms
4,348 KB
testcase_04 AC 1 ms
4,352 KB
testcase_05 AC 1 ms
4,356 KB
testcase_06 AC 2 ms
4,348 KB
testcase_07 AC 1 ms
4,352 KB
testcase_08 AC 2 ms
4,352 KB
testcase_09 AC 1 ms
4,352 KB
testcase_10 AC 2 ms
4,348 KB
testcase_11 AC 2 ms
4,352 KB
testcase_12 AC 2 ms
4,352 KB
testcase_13 AC 2 ms
4,376 KB
testcase_14 AC 2 ms
4,352 KB
testcase_15 AC 3 ms
4,348 KB
testcase_16 AC 2 ms
4,348 KB
testcase_17 AC 2 ms
4,348 KB
testcase_18 AC 1 ms
4,348 KB
testcase_19 AC 2 ms
4,352 KB
testcase_20 AC 2 ms
4,352 KB
testcase_21 AC 1 ms
4,348 KB
testcase_22 AC 1 ms
4,352 KB
testcase_23 AC 2 ms
4,348 KB
testcase_24 AC 1 ms
4,348 KB
testcase_25 AC 2 ms
4,356 KB
testcase_26 AC 1 ms
4,356 KB
testcase_27 AC 2 ms
4,352 KB
testcase_28 AC 2 ms
4,348 KB
testcase_29 AC 2 ms
4,352 KB
testcase_30 AC 2 ms
4,352 KB
testcase_31 AC 2 ms
4,376 KB
testcase_32 AC 2 ms
4,352 KB
testcase_33 AC 2 ms
4,352 KB
testcase_34 AC 2 ms
4,352 KB
testcase_35 AC 2 ms
4,352 KB
testcase_36 WA -
testcase_37 WA -
testcase_38 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
//#include<atcoder/all>
//using namespace atcoder;
using ll = long long int;
using ull = unsigned long long int;
using ld = long double;
constexpr ll MAX = 2000000000000000000;
constexpr ld PI = 3.14159265358979;
constexpr ll MOD = 0;//2024948111;
ld dotorad(ld K){return PI * K / 180.0;}
ld radtodo(ld K){return K * 180.0 / PI;}
mt19937 mt;
void randinit(){srand((unsigned)time(NULL));mt = mt19937(rand());}
int main(){
    ll N,D;
    cin >> N >> D;
    vector<ll> P(N),Q(N);
    for(ll i = 0;i < N;i++) cin >> P[i] >> Q[i];
    vector<tuple<ll,ll>> H(N);
    for(ll i = 0;i < N;i++) H[i] = make_tuple(-P[i] + Q[i],P[i]);
    sort(H.begin(),H.end());
    reverse(H.begin(),H.end());
    ll l = -MAX,r = 1;
    while(r - l > 1){
        ll m = (l + r) / 2,n = 0,ok = 1,kinsi = -1;
        for(ll i = 0;i < D;i++){
            ll o = 0;
            for(ll j = 0;j < N;j++){
                if(n - get<1>(H[j]) >= m && kinsi != j){
                    kinsi = j;
                    n += get<0>(H[j]);
                    o = 1;
                    break;
                }
            }
            if(!o){
                ok = 0;
                break;
            }
        }
        if(ok) l = m;
        else r = m;
    }
    cout << l << endl;
}
0