結果

問題 No.817 Coin donation
ユーザー graphegraphe
提出日時 2019-04-19 23:21:51
言語 C++11
(gcc 11.4.0)
結果
WA  
実行時間 -
コード長 832 bytes
コンパイル時間 3,265 ms
コンパイル使用メモリ 163,436 KB
実行使用メモリ 390,984 KB
最終ジャッジ日時 2023-10-24 12:49:43
合計ジャッジ時間 5,731 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

#include <bits/stdc++.h>

#define rep(i, n) for(int i = 0, i##_len = (n); i < i##_len; ++i)
#define repp(i, m, n) for(int i = m, i##_len = (n); i < i##_len; ++i)
#define all(x) (x).begin(), (x).end()
#define clr(ar, val) memset(ar, val, sizeof(ar))
template <class T> bool chmax(T &a, const T &b) { if (a < b) { a = b; return 1; } return 0; }
template <class T> bool chmin(T &a, const T &b) { if (b < a) { a = b; return 1; } return 0; }
int gcd(int a,int b){return b?gcd(b,a%b):a;}
using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef pair <int,int> P;
typedef long double ld;

int main(void)
{
	priority_queue<int> que;
	int n, k, a, b;
	cin >> n >> k;
	rep(i, n){
		cin >> a >> b;
		repp(j, a, min(a + k, b) + 1){
			que.push(j);
		}
	}
	rep(i, k) que.pop();
	cout << que.top() << endl;
	return 0;
}
0