# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
132006 | ekrem | Two Dishes (JOI19_dishes) | C++98 | 201 ms | 26400 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
#define st first
#define nd second
#define mp make_pair
#define pb push_back
#define sol (k+k)
#define sag (k+k+1)
#define orta ((bas+son)/2)
#define coc g[node][i]
#define mod 1000000007
#define inf 100000000000000009
#define N 1000005
using namespace std;
typedef long long ll;
typedef pair < ll , ll > ii;
ll n, m, nn, mm, ans, a[2][N], b[2][N], c[2][N], pre[2][N];
int main() {
// freopen("in.txt", "r", stdin);
// freopen("out.txt", "w", stdout);
scanf("%lld %lld",&n ,&m);
for(ll i = 1; i <= n; i++){
scanf("%lld %lld %lld",&a[0][i] ,&b[0][i] ,&c[0][i]);
pre[0][i] = pre[0][i - 1] + a[0][i];
}
for(ll i = 1; i <= m; i++){
scanf("%lld %lld %lld",&a[1][i] ,&b[1][i] ,&c[1][i]);
pre[1][i] = pre[1][i - 1] + a[1][i];
}
c[0][0] = c[1][0] = inf;
nn = n;mm = m;
for(ll i = 1; i <= n + m; i++){
ll x = (pre[0][nn] + pre[1][mm] <= b[0][nn])?c[0][nn]:-c[0][nn];
ll y = (pre[0][nn] + pre[1][mm] <= b[1][mm])?c[1][mm]:-c[1][mm];
if(x > y){
ans += max(0ll, x);
nn--;
} else{
ans += max(0ll, y);
mm--;
}
}
printf("%lld\n", ans);
return 0;
}
컴파일 시 표준 에러 (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... |