結果
問題 | No.817 Coin donation |
ユーザー |
![]() |
提出日時 | 2019-04-19 23:10:00 |
言語 | C++14 (gcc 12.2.0 + boost 1.81.0) |
結果 |
AC
|
実行時間 | 69 ms / 2,000 ms |
コード長 | 464 bytes |
コンパイル時間 | 529 ms |
実行使用メモリ | 9,724 KB |
最終ジャッジ日時 | 2023-04-01 02:36:48 |
合計ジャッジ時間 | 2,512 ms |
ジャッジサーバーID (参考情報) |
judge12 / judge11 |
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 2 ms
7,668 KB |
testcase_01 | AC | 2 ms
7,616 KB |
testcase_02 | AC | 1 ms
7,548 KB |
testcase_03 | AC | 1 ms
7,616 KB |
testcase_04 | AC | 1 ms
9,704 KB |
testcase_05 | AC | 3 ms
9,720 KB |
testcase_06 | AC | 11 ms
7,540 KB |
testcase_07 | AC | 13 ms
9,724 KB |
testcase_08 | AC | 48 ms
7,600 KB |
testcase_09 | AC | 14 ms
7,604 KB |
testcase_10 | AC | 69 ms
7,544 KB |
testcase_11 | AC | 69 ms
7,548 KB |
testcase_12 | AC | 68 ms
7,608 KB |
testcase_13 | AC | 1 ms
7,604 KB |
testcase_14 | AC | 2 ms
7,584 KB |
testcase_15 | AC | 1 ms
7,600 KB |
コンパイルメッセージ
main.cpp:8:1: 警告: ISO C++ では型の無い ‘main’ の宣言を禁止しています [-Wreturn-type] 8 | main() | ^~~~
ソースコード
#include<iostream> #include<vector> #include<algorithm> #include<queue> using namespace std; int N,K; vector<pair<int,int> >A; main() { cin>>N>>K; for(int i=0;i<N;i++) { int a,b;cin>>a>>b; A.push_back({a,b}); } int L=0,R=1e9+114514; while(R-L>1) { int M=(L+R)/2; int now=K; for(int i=0;i<N;i++) { if(A[i].first<=M) { now-=min(M,A[i].second)-A[i].first+1; if(now<=0)break; } } if(now<=0)R=M; else L=M; } cout<<R<<endl; }