Submission #1018947

# Submission time Handle Problem Language Result Execution time Memory
1018947 2024-07-10T11:12:30 Z 변재우(#10906) Two Dishes (JOI19_dishes) C++17
5 / 100
96 ms 35268 KB
#include <bits/stdc++.h>
#define int long long
using namespace std;

const int Nmax=1000010;
int N, M, ans, sum, curr, A[Nmax], S[Nmax], P[Nmax], B[Nmax], T[Nmax], Q[Nmax];

signed main() {
    ios_base::sync_with_stdio(0); cin.tie(0);
    cin>>N>>M;
    for(int i=1; i<=N; i++) cin>>A[i]>>S[i]>>P[i];
    for(int i=1; i<=M; i++) cin>>B[i]>>T[i]>>Q[i], sum+=B[i], curr+=Q[i];
    for(int i=0, j=M; i<=N; i++) {
        sum+=A[i], curr+=P[i];
        while(j>=1 && sum>S[1]) sum-=B[j], curr-=Q[j--];
        if(sum>S[1]) break;
        ans=max(ans, curr);
    }
    cout<<ans;
    return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 83 ms 21124 KB Output is correct
2 Correct 82 ms 21080 KB Output is correct
3 Correct 81 ms 19592 KB Output is correct
4 Correct 82 ms 19540 KB Output is correct
5 Correct 1 ms 10588 KB Output is correct
6 Correct 88 ms 34364 KB Output is correct
7 Correct 46 ms 23892 KB Output is correct
8 Correct 48 ms 21584 KB Output is correct
9 Correct 96 ms 35268 KB Output is correct
10 Correct 62 ms 28356 KB Output is correct
11 Correct 66 ms 28752 KB Output is correct
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 10588 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 10588 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 10588 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 10588 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 10588 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 83 ms 21124 KB Output is correct
2 Correct 82 ms 21080 KB Output is correct
3 Correct 81 ms 19592 KB Output is correct
4 Correct 82 ms 19540 KB Output is correct
5 Correct 1 ms 10588 KB Output is correct
6 Correct 88 ms 34364 KB Output is correct
7 Correct 46 ms 23892 KB Output is correct
8 Correct 48 ms 21584 KB Output is correct
9 Correct 96 ms 35268 KB Output is correct
10 Correct 62 ms 28356 KB Output is correct
11 Correct 66 ms 28752 KB Output is correct
12 Incorrect 1 ms 10588 KB Output isn't correct
13 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 83 ms 21124 KB Output is correct
2 Correct 82 ms 21080 KB Output is correct
3 Correct 81 ms 19592 KB Output is correct
4 Correct 82 ms 19540 KB Output is correct
5 Correct 1 ms 10588 KB Output is correct
6 Correct 88 ms 34364 KB Output is correct
7 Correct 46 ms 23892 KB Output is correct
8 Correct 48 ms 21584 KB Output is correct
9 Correct 96 ms 35268 KB Output is correct
10 Correct 62 ms 28356 KB Output is correct
11 Correct 66 ms 28752 KB Output is correct
12 Incorrect 1 ms 10588 KB Output isn't correct
13 Halted 0 ms 0 KB -