Submission #860765

# Submission time Handle Problem Language Result Execution time Memory
860765 2023-10-14T07:39:35 Z browntoad Two Dishes (JOI19_dishes) C++14
10 / 100
1448 ms 96984 KB
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define int ll
#define pii pair<int, int>
#define ppi pair<pii, int>
#define pip pair<int, pii>
#define pb push_back
#define ALL(x) (x).begin(), (x).end()
#define FOR(i, a, b) for (int i = (a); i < (b); i++)
#define REP(i, n) FOR(i, 0, n)
#define REP1(i, n) FOR(i, 1, n+1)
#define RREP(i, n) for (int i = (n)-1; i >= 0; i--)
#define SZ(x) (int)((x).size())

const ll maxn = 2005;
const ll inf = (1ll<<60);
const ll mod = 1e9+7;

int n, m;
int dp[maxn][maxn];
signed main(){
	ios::sync_with_stdio(false), cin.tie(0), cout.tie(0);
	cin>>n>>m;
	vector<int> a(n+1), s(n+1), p(n+1);
	vector<int> b(m+1), t(m+1), q(m+1);
	REP1(i, n) cin>>a[i]>>s[i]>>p[i];
	REP1(j, m) cin>>b[j]>>t[j]>>q[j];
	REP1(i, n) a[i] += a[i-1];
	REP1(j, m) b[j] += b[j-1];
	REP(i, n+1){
		REP(j, m+1){
			if (i > 0) dp[i][j] = max(dp[i][j], dp[i-1][j] + (a[i]+b[j] <= s[i]));
			if (j > 0) dp[i][j] = max(dp[i][j], dp[i][j-1] + (a[i]+b[j] <= t[j]));
		}
	}
	cout<<dp[n][m]<<endl;


}
# Verdict Execution time Memory Grader output
1 Runtime error 1448 ms 96984 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 1 ms 348 KB Output is correct
3 Correct 1 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 0 ms 348 KB Output is correct
7 Correct 1 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 344 KB Output is correct
11 Correct 0 ms 348 KB Output is correct
12 Correct 0 ms 348 KB Output is correct
13 Correct 0 ms 348 KB Output is correct
14 Correct 1 ms 468 KB Output is correct
15 Correct 0 ms 344 KB Output is correct
16 Correct 1 ms 600 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 1 ms 348 KB Output is correct
3 Correct 1 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 0 ms 348 KB Output is correct
7 Correct 1 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 344 KB Output is correct
11 Correct 0 ms 348 KB Output is correct
12 Correct 0 ms 348 KB Output is correct
13 Correct 0 ms 348 KB Output is correct
14 Correct 1 ms 468 KB Output is correct
15 Correct 0 ms 344 KB Output is correct
16 Correct 1 ms 600 KB Output is correct
17 Correct 27 ms 31852 KB Output is correct
18 Correct 27 ms 32012 KB Output is correct
19 Correct 30 ms 31832 KB Output is correct
20 Correct 26 ms 31828 KB Output is correct
21 Correct 27 ms 31028 KB Output is correct
22 Correct 27 ms 32076 KB Output is correct
23 Correct 28 ms 31832 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 1 ms 348 KB Output is correct
3 Correct 1 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 0 ms 348 KB Output is correct
7 Correct 1 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 344 KB Output is correct
11 Correct 0 ms 348 KB Output is correct
12 Correct 0 ms 348 KB Output is correct
13 Correct 0 ms 348 KB Output is correct
14 Correct 1 ms 468 KB Output is correct
15 Correct 0 ms 344 KB Output is correct
16 Correct 1 ms 600 KB Output is correct
17 Correct 27 ms 31852 KB Output is correct
18 Correct 27 ms 32012 KB Output is correct
19 Correct 30 ms 31832 KB Output is correct
20 Correct 26 ms 31828 KB Output is correct
21 Correct 27 ms 31028 KB Output is correct
22 Correct 27 ms 32076 KB Output is correct
23 Correct 28 ms 31832 KB Output is correct
24 Runtime error 1447 ms 93964 KB Execution killed with signal 11
25 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 1 ms 348 KB Output is correct
3 Correct 1 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 0 ms 348 KB Output is correct
7 Correct 1 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 344 KB Output is correct
11 Correct 0 ms 348 KB Output is correct
12 Correct 0 ms 348 KB Output is correct
13 Correct 0 ms 348 KB Output is correct
14 Correct 1 ms 468 KB Output is correct
15 Correct 0 ms 344 KB Output is correct
16 Correct 1 ms 600 KB Output is correct
17 Correct 27 ms 31852 KB Output is correct
18 Correct 27 ms 32012 KB Output is correct
19 Correct 30 ms 31832 KB Output is correct
20 Correct 26 ms 31828 KB Output is correct
21 Correct 27 ms 31028 KB Output is correct
22 Correct 27 ms 32076 KB Output is correct
23 Correct 28 ms 31832 KB Output is correct
24 Runtime error 1447 ms 93964 KB Execution killed with signal 11
25 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 1 ms 348 KB Output is correct
3 Correct 1 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 0 ms 348 KB Output is correct
7 Correct 1 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 344 KB Output is correct
11 Correct 0 ms 348 KB Output is correct
12 Correct 0 ms 348 KB Output is correct
13 Correct 0 ms 348 KB Output is correct
14 Correct 1 ms 468 KB Output is correct
15 Correct 0 ms 344 KB Output is correct
16 Correct 1 ms 600 KB Output is correct
17 Correct 27 ms 31852 KB Output is correct
18 Correct 27 ms 32012 KB Output is correct
19 Correct 30 ms 31832 KB Output is correct
20 Correct 26 ms 31828 KB Output is correct
21 Correct 27 ms 31028 KB Output is correct
22 Correct 27 ms 32076 KB Output is correct
23 Correct 28 ms 31832 KB Output is correct
24 Runtime error 1447 ms 93964 KB Execution killed with signal 11
25 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 1448 ms 96984 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 1448 ms 96984 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -