| # | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 | 
|---|---|---|---|---|---|---|---|
| 307235 | Rainbowbunny | Coins (BOI06_coins) | C++17 | 94 ms | 9980 KiB | 
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
#define mp make_pair
#define eb emplace_back
#define fi first
#define se second
using namespace std;
using cd = complex <double>;
 
const long long INF = 1e15;
const int N = 3e5 + 2;
//const int mod = 1e9 + 7;//998244353;//1e9 + 7;//786433;
const double Pi = acos(-1);
 
void Fastio()
{
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
}
 
int n, k;
int cnt, ans;
int a[500005], b[500005];
 
signed main()
{
	Fastio();
	cin >> n >> k;
	for(int i = 1; i <= n; i++)
	{
		cin >> a[i] >> b[i];
	}
	a[n + 1] = k;
	for(int i = 1; i <= n; i++)
	{
		if(b[i] == 0 and ans + a[i] < a[i + 1])
		{
			ans += a[i];
			cnt++;
		}
	}
	cout << cnt << '\n' << min(k - ans, k - 1);
}
| # | Verdict | Execution time | Memory | Grader output | 
|---|---|---|---|---|
| Fetching results... | ||||
