結果

問題 No.817 Coin donation
ユーザー graphegraphe
提出日時 2019-04-19 23:13:19
言語 C++11
(gcc 11.4.0)
結果
TLE  
実行時間 -
コード長 882 bytes
コンパイル時間 1,563 ms
コンパイル使用メモリ 159,708 KB
実行使用メモリ 9,500 KB
最終ジャッジ日時 2023-10-24 12:01:09
合計ジャッジ時間 5,307 ms
ジャッジサーバーID
(参考情報)
judge12 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
9,500 KB
testcase_01 AC 3 ms
5,152 KB
testcase_02 TLE -
testcase_03 -- -
testcase_04 -- -
testcase_05 -- -
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)
{
	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