| # | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
|---|---|---|---|---|---|---|---|
| 96219 | Kastanda | 금 캐기 (IZhO14_divide) | C++11 | 58 ms | 7664 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include<bits/stdc++.h>
#define lc (id << 1)
#define rc (id << 1 ^ 1)
#define md ((l + r) >> 1)
using namespace std;
typedef long long ll;
const int N = 100005;
int n;
ll D[N], E[N], G[N], MN[N * 4];
void Build(int id = 1, int l = 0, int r = n + 1)
{
if (r - l < 2)
{
MN[id] = D[l] - E[l];
return ;
}
Build(lc, l, md);
Build(rc, md, r);
MN[id] = min(MN[lc], MN[rc]);
}
int Get(ll val, int id = 1, int l = 0, int r = n + 1)
{
if (MN[id] > val)
return (-1);
if (r - l < 2)
return (l);
int i = Get(val, rc, md, r);
if (i != -1) return (i);
return (Get(val, lc, l, md));
}
int main()
{
scanf("%d", &n);
for (int i = 1; i <= n; i++)
{
scanf("%lld%lld%lld", &D[i], &G[i], &E[i]);
E[i] += E[i - 1]; G[i] += G[i - 1];
}
D[0] = -1e17;
Build();
ll Max = 0;
for (int i = 1; i <= n; i++)
{
int j = Get(D[i] - E[i - 1]);
if (j >= i)
Max = max(Max, G[j] - G[i - 1]);
}
return !printf("%lld\n", Max);
}
컴파일 시 표준 에러 (stderr) 메시지
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
