結果

問題 No.817 Coin donation
ユーザー eSeFeSeF
提出日時 2020-11-06 11:37:45
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 77 ms / 2,000 ms
コード長 1,416 bytes
コンパイル時間 1,067 ms
コンパイル使用メモリ 121,620 KB
実行使用メモリ 4,380 KB
最終ジャッジ日時 2023-09-29 17:40:36
合計ジャッジ時間 3,475 ms
ジャッジサーバーID
(参考情報)
judge11 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,376 KB
testcase_01 AC 2 ms
4,380 KB
testcase_02 AC 2 ms
4,376 KB
testcase_03 AC 2 ms
4,380 KB
testcase_04 AC 2 ms
4,376 KB
testcase_05 AC 4 ms
4,380 KB
testcase_06 AC 11 ms
4,380 KB
testcase_07 AC 14 ms
4,376 KB
testcase_08 AC 53 ms
4,376 KB
testcase_09 AC 17 ms
4,380 KB
testcase_10 AC 77 ms
4,376 KB
testcase_11 AC 77 ms
4,380 KB
testcase_12 AC 77 ms
4,376 KB
testcase_13 AC 2 ms
4,380 KB
testcase_14 AC 2 ms
4,380 KB
testcase_15 AC 1 ms
4,376 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<iostream>
#include<iomanip>
#include<limits>
#include<stdio.h>
#include<math.h>
#include<algorithm>
#include<queue>
#include<deque>
#include<stack>
#include<string>
#include<string.h>
#include<vector>
#include<set>
#include<map>
#include<bitset>
#include<stdlib.h>
#include<cassert>
#include<time.h>
#include<bitset>
#include<numeric>
#include<unordered_set>
#include<unordered_map>
#include<complex>
using namespace std;
typedef long long ll;
const int mod = 1e9 + 7;
const ll infll = (1LL << 62) - 1;
const int inf = (1 << 30) - 1;
#define rep(i,n) for (int i=0; i < (n); i++)
typedef double D;      // 座標値の型。doubleかlong doubleを想定
typedef complex<D> P;  // Point
typedef pair<P, P> L;  // Line
typedef vector<P> VP;
const D EPS = 1e-9;    // 許容誤差。問題によって変える
#define X real()
#define Y imag()
#define LE(n,m) ((n) < (m) + EPS)
#define GE(n,m) ((n) + EPS > (m))
#define EQ(n,m) (abs((n)-(m)) < EPS)
D dot(P a, P b) {
  return (conj(a)*b).X;
}
int main(){
    cout << fixed << setprecision(10);
    int N,K;
    cin >> N >> K;
    vector<int>A(N),B(N);
    rep(i,N)cin >> A[i] >> B[i];
    int L=0,R=(int)1e9+1;
    while(R-L>1){
        int mid=(L+R)>>1;
        ll cn=0;
        rep(i,N){
            if(A[i]>mid)continue;
            cn+=min(B[i],mid)-A[i]+1;
        }
        if(cn>=K)R=mid;
        else L=mid;
    }
    cout << R << endl;
    return 0;
}
0