# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
122810 | WhipppedCream | Two Dishes (JOI19_dishes) | C++17 | 220 ms | 23524 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
#pragma GCC optimize ("O3")
#pragma GCC target ("sse4")
using namespace std;
#define X first
#define Y second
#define pb push_back
typedef pair<int, int> ii;
typedef long long ll;
const int maxn = 1e6+5;
int n, m;
ll a[maxn];
ll b[maxn];
ll p[maxn];
ll q[maxn];
ll s[maxn];
ll t[maxn];
int find_end(ll k)
{
return upper_bound(b+1, b+m+1, k)-b-1;
}
int main()
{
scanf("%d %d", &n, &m);
for(int i = 1; i<= n; i++) scanf("%lld %lld %lld", &a[i], &s[i], &p[i]);
for(int i = 1; i<= m; i++) scanf("%lld %lld %lld", &b[i], &t[i], &q[i]);
ll lim = t[1];
for(int i = 1; i<= m; i++)
{
b[i] += b[i-1];
q[i] += q[i-1];
}
ll run = 0;
ll cum = 0;
ll best = -1e18;
best = max(best, q[find_end(lim)]);
for(int i = 1; i<= n; i++)
{
run += a[i];
cum += p[i];
best = max(best, cum+q[find_end(lim-run)]);
}
printf("%lld\n", best);
}
컴파일 시 표준 에러 (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... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |