# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
572850 | denniskim | Coins (BOI06_coins) | C++17 | 94 ms | 8060 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
#define MAX 9223372036854775807LL
#define MIN -9223372036854775807LL
#define INF 0x3f3f3f3f3f3f3f3f
#define fi first
#define se second
ll n, k;
pair<ll, ll> a[500010];
ll ans1, ans2;
int main(void)
{
scanf("%lld %lld", &n, &k);
for(ll i = 1 ; i <= n ; i++)
scanf("%lld %lld", &a[i].fi, &a[i].se);
for(ll i = 1 ; i <= n ; i++)
{
if(a[i].se)
continue;
if(ans1 + a[i].fi < min(a[i + 1].fi, k + 1))
{
ans1 += a[i].fi;
ans2++;
}
}
if(!ans1)
ans1 = 1;
printf("%lld\n%lld", ans2, k - ans1);
return 0;
}
컴파일 시 표준 에러 (stderr) 메시지
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |