Submission #861100

# Submission time Handle Problem Language Result Execution time Memory
861100 2023-10-15T09:59:52 Z yeediot Two Dishes (JOI19_dishes) C++14
10 / 100
27 ms 32092 KB
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define F first
#define S second
#define all(x) x.begin(),x.end()
#define pii pair<int,int>
#define pb push_back
#define sz(x) (int)(x.size())
#define chmin(x,y) x=min(x,y)
#define chmax(x,y) x=max(x,y)
#define vi vector<int>
#define vp vector<pii>
#define vvi vector<vi>
//Don't open the standings during contests.
const int mxn=2005;
vector<int>a(mxn),s(mxn),p(mxn),b(mxn),t(mxn),q(mxn),pre(mxn),pre2(mxn);
signed main(){
    ios::sync_with_stdio(0);
    cin.tie(0);cout.tie(0);
    int n,m;
    cin>>n>>m;
    for(int i=1;i<=n;i++){
        cin>>a[i]>>s[i]>>p[i];
        pre[i]=pre[i-1]+a[i];
    }
    for(int i=1;i<=m;i++){
        cin>>b[i]>>t[i]>>q[i];
        pre2[i]=pre2[i-1]+b[i];
    }
    vector<vector<int>>dp(n+1,vector<int>(m+1,-8e18));
    dp[0][0]=0;
    for(int i=0;i<=n;i++){
        for(int j=0;j<=m;j++){
            if(i)chmax(dp[i][j],dp[i-1][j]+(pre[i]+pre2[j]<=s[i])*p[i]);
            if(j)chmax(dp[i][j],dp[i][j-1]+(pre[i]+pre2[j]<=t[j])*q[j]);
        }
    }
    cout<<dp[n][m]<<'\n';
}
 /*
 input:
 
 */

# Verdict Execution time Memory Grader output
1 Runtime error 5 ms 1628 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 1 ms 348 KB Output is correct
7 Correct 0 ms 348 KB Output is correct
8 Correct 0 ms 348 KB Output is correct
9 Correct 0 ms 348 KB Output is correct
10 Correct 0 ms 348 KB Output is correct
11 Correct 0 ms 584 KB Output is correct
12 Correct 1 ms 344 KB Output is correct
13 Correct 1 ms 348 KB Output is correct
14 Correct 0 ms 348 KB Output is correct
15 Correct 1 ms 348 KB Output is correct
16 Correct 0 ms 348 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 1 ms 348 KB Output is correct
7 Correct 0 ms 348 KB Output is correct
8 Correct 0 ms 348 KB Output is correct
9 Correct 0 ms 348 KB Output is correct
10 Correct 0 ms 348 KB Output is correct
11 Correct 0 ms 584 KB Output is correct
12 Correct 1 ms 344 KB Output is correct
13 Correct 1 ms 348 KB Output is correct
14 Correct 0 ms 348 KB Output is correct
15 Correct 1 ms 348 KB Output is correct
16 Correct 0 ms 348 KB Output is correct
17 Correct 27 ms 32092 KB Output is correct
18 Correct 26 ms 32092 KB Output is correct
19 Correct 27 ms 32092 KB Output is correct
20 Correct 25 ms 29784 KB Output is correct
21 Correct 25 ms 30808 KB Output is correct
22 Correct 27 ms 31836 KB Output is correct
23 Correct 26 ms 31836 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 1 ms 348 KB Output is correct
7 Correct 0 ms 348 KB Output is correct
8 Correct 0 ms 348 KB Output is correct
9 Correct 0 ms 348 KB Output is correct
10 Correct 0 ms 348 KB Output is correct
11 Correct 0 ms 584 KB Output is correct
12 Correct 1 ms 344 KB Output is correct
13 Correct 1 ms 348 KB Output is correct
14 Correct 0 ms 348 KB Output is correct
15 Correct 1 ms 348 KB Output is correct
16 Correct 0 ms 348 KB Output is correct
17 Correct 27 ms 32092 KB Output is correct
18 Correct 26 ms 32092 KB Output is correct
19 Correct 27 ms 32092 KB Output is correct
20 Correct 25 ms 29784 KB Output is correct
21 Correct 25 ms 30808 KB Output is correct
22 Correct 27 ms 31836 KB Output is correct
23 Correct 26 ms 31836 KB Output is correct
24 Runtime error 5 ms 1628 KB Execution killed with signal 11
25 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 1 ms 348 KB Output is correct
7 Correct 0 ms 348 KB Output is correct
8 Correct 0 ms 348 KB Output is correct
9 Correct 0 ms 348 KB Output is correct
10 Correct 0 ms 348 KB Output is correct
11 Correct 0 ms 584 KB Output is correct
12 Correct 1 ms 344 KB Output is correct
13 Correct 1 ms 348 KB Output is correct
14 Correct 0 ms 348 KB Output is correct
15 Correct 1 ms 348 KB Output is correct
16 Correct 0 ms 348 KB Output is correct
17 Correct 27 ms 32092 KB Output is correct
18 Correct 26 ms 32092 KB Output is correct
19 Correct 27 ms 32092 KB Output is correct
20 Correct 25 ms 29784 KB Output is correct
21 Correct 25 ms 30808 KB Output is correct
22 Correct 27 ms 31836 KB Output is correct
23 Correct 26 ms 31836 KB Output is correct
24 Runtime error 5 ms 1628 KB Execution killed with signal 11
25 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 1 ms 348 KB Output is correct
7 Correct 0 ms 348 KB Output is correct
8 Correct 0 ms 348 KB Output is correct
9 Correct 0 ms 348 KB Output is correct
10 Correct 0 ms 348 KB Output is correct
11 Correct 0 ms 584 KB Output is correct
12 Correct 1 ms 344 KB Output is correct
13 Correct 1 ms 348 KB Output is correct
14 Correct 0 ms 348 KB Output is correct
15 Correct 1 ms 348 KB Output is correct
16 Correct 0 ms 348 KB Output is correct
17 Correct 27 ms 32092 KB Output is correct
18 Correct 26 ms 32092 KB Output is correct
19 Correct 27 ms 32092 KB Output is correct
20 Correct 25 ms 29784 KB Output is correct
21 Correct 25 ms 30808 KB Output is correct
22 Correct 27 ms 31836 KB Output is correct
23 Correct 26 ms 31836 KB Output is correct
24 Runtime error 5 ms 1628 KB Execution killed with signal 11
25 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 5 ms 1628 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 5 ms 1628 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -