結果

問題 No.817 Coin donation
ユーザー CleyLCleyL
提出日時 2022-12-30 17:02:24
言語 C++17
(gcc 13.2.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 477 bytes
コンパイル時間 887 ms
コンパイル使用メモリ 86,344 KB
実行使用メモリ 16,144 KB
最終ジャッジ日時 2023-08-16 22:52:08
合計ジャッジ時間 2,607 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,380 KB
testcase_01 AC 2 ms
4,376 KB
testcase_02 AC 2 ms
4,376 KB
testcase_03 AC 2 ms
4,376 KB
testcase_04 WA -
testcase_05 AC 5 ms
4,380 KB
testcase_06 AC 20 ms
5,000 KB
testcase_07 AC 27 ms
5,544 KB
testcase_08 AC 135 ms
11,988 KB
testcase_09 AC 32 ms
5,864 KB
testcase_10 AC 219 ms
15,864 KB
testcase_11 AC 220 ms
15,940 KB
testcase_12 AC 220 ms
16,144 KB
testcase_13 WA -
testcase_14 WA -
testcase_15 AC 1 ms
4,376 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <map>
#include <vector>
using namespace std;
int main(){
  long long n,k;cin>>n>>k;
  map<int,long long> A;
  for(int i = 0; n > i; i++){
    int a,b;cin>>a>>b;
    A[a]++;
    A[b+1]--;
  }
  int prev = -1;
  long long nw = 0;
  long long pres = 0;
  for(auto x: A){
    if((x.first-prev)*nw + pres >= k){
      cout << prev+(k-pres^1)/nw << endl;
      return 0;
    }
    pres += (x.first-prev)*nw;
    nw += x.second;
    prev = x.first;
  }
}
0