結果
| 問題 | No.817 Coin donation |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2019-04-19 23:10:00 |
| 言語 | C++14 (gcc 15.3.0 + boost 1.92.0 + ACL) |
| 結果 |
AC
不安定
|
| 実行時間 | 56 ms / 2,000 ms |
| + 762µs | |
| コード長 | 464 bytes |
| 記録 | |
| コンパイル時間 | 529 ms |
| コンパイル使用メモリ | 90,168 KB |
| 実行使用メモリ | 6,400 KB |
| 最終ジャッジ日時 | 2026-10-14 10:11:53 |
| 合計ジャッジ時間 | 2,382 ms |
|
ジャッジサーバーID (参考情報) |
judge3_0 / judge2_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 16 |
コンパイルメッセージ
main.cpp:8:1: warning: ISO C++ forbids declaration of 'main' with no type [-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;
}