結果

問題 No.817 Coin donation
ユーザー graphe
提出日時 2019-04-19 23:13:19
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
TLE  
実行時間 -
コード長 882 bytes
コンパイル時間 1,680 ms
コンパイル使用メモリ 158,116 KB
実行使用メモリ 13,760 KB
最終ジャッジ日時 2024-09-23 04:20:24
合計ジャッジ時間 4,855 ms
ジャッジサーバーID
(参考情報)
judge3 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other TLE * 1 -- * 13
権限があれば一括ダウンロードができます

ソースコード

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)
{
	long n, k, a[100000], b[100000], c[100000];
	long tmp = 0, ans = 0;
	cin >> n >> k;
	rep(i, n){
		cin >> a[i] >> b[i];
	}
	while(tmp < k){
		rep(i, n){
			if(a[i] <= ans && ans <= b[i]) tmp++;
		}
		if(tmp < k) ans++;
	}
	cout << ans << endl;
	return 0;
}
0